4 types derived from HtmlEncoder
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
DefaultEditorTemplates.cs (1)
487
private sealed class PassThroughHtmlEncoder :
HtmlEncoder
Microsoft.AspNetCore.Razor (1)
TagHelpers\NullHtmlEncoder.cs (1)
13
public sealed class NullHtmlEncoder :
HtmlEncoder
Microsoft.Extensions.WebEncoders (1)
Testing\HtmlTestEncoder.cs (1)
14
public sealed class HtmlTestEncoder :
HtmlEncoder
System.Text.Encodings.Web (1)
System\Text\Encodings\Web\DefaultHtmlEncoder.cs (1)
11
internal sealed class DefaultHtmlEncoder :
HtmlEncoder
167 references to HtmlEncoder
Aspire.Dashboard (1)
Model\Assistant\Markdown\ResourceInlineRenderer.cs (1)
16
var encodedResourceName =
HtmlEncoder
.Default.Encode(inline.ResourceName);
Microsoft.AspNetCore.Components.Endpoints (9)
RazorComponentEndpointInvoker.cs (2)
161
htmlContent.WriteTo(bufferWriter,
HtmlEncoder
.Default); // Don't use WriteToAsync, as per the comment above
180
componentStateHtmlContent.WriteTo(bufferWriter,
HtmlEncoder
.Default);
Rendering\EndpointHtmlRenderer.Prerendering.cs (3)
344
WriteTo(writer,
HtmlEncoder
.Default);
348
await _dispatcher.InvokeAsync(() => WriteTo(writer,
HtmlEncoder
.Default));
352
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
Rendering\EndpointHtmlRenderer.PrerenderingState.cs (1)
215
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
Rendering\EndpointHtmlRenderer.Streaming.cs (2)
225
writer.Write(
HtmlEncoder
.Default.Encode(message));
255
writer.Write(
HtmlEncoder
.Default.Encode(OpaqueRedirection.CreateProtectedRedirectionUrl(httpContext, destinationUrl)));
Results\RazorComponentResultExecutor.cs (1)
82
htmlContent.WriteTo(bufferWriter,
HtmlEncoder
.Default); // Don't use WriteToAsync, as per the comment above
Microsoft.AspNetCore.Components.Web (2)
HtmlRendering\StaticHtmlRenderer.cs (2)
35
_htmlEncoder = serviceProvider.GetService<
HtmlEncoder
>() ??
HtmlEncoder
.Default;
Microsoft.AspNetCore.Diagnostics (4)
src\aspnetcore\src\Shared\Diagnostics\BaseView.cs (2)
45
protected
HtmlEncoder
HtmlEncoder { get; set; } =
HtmlEncoder
.Default;
src\aspnetcore\src\Shared\RazorViews\BaseView.cs (2)
48
protected
HtmlEncoder
HtmlEncoder { get; set; } =
HtmlEncoder
.Default;
Microsoft.AspNetCore.Hosting (2)
src\aspnetcore\src\Shared\RazorViews\BaseView.cs (2)
48
protected
HtmlEncoder
HtmlEncoder { get; set; } =
HtmlEncoder
.Default;
Microsoft.AspNetCore.Html.Abstractions (9)
HtmlContentBuilder.cs (2)
157
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
183
WriteTo(writer,
HtmlEncoder
.Default);
HtmlFormattableString.cs (4)
55
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
68
WriteTo(writer,
HtmlEncoder
.Default);
82
private readonly
HtmlEncoder
_encoder;
87
public EncodingFormatProvider(IFormatProvider formatProvider,
HtmlEncoder
encoder)
HtmlString.cs (1)
38
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
IHtmlContent.cs (2)
18
/// <param name="encoder">The <see cref="
HtmlEncoder
"/> which encodes the content to be written.</param>
19
void WriteTo(TextWriter writer,
HtmlEncoder
encoder);
Microsoft.AspNetCore.Identity (2)
IdentityApiEndpointRouteBuilderExtensions.cs (2)
217
await emailSender.SendPasswordResetCodeAsync(user, resetRequest.Email,
HtmlEncoder
.Default.Encode(code));
418
await emailSender.SendConfirmationLinkAsync(user, email,
HtmlEncoder
.Default.Encode(confirmEmailUrl));
Microsoft.AspNetCore.Mvc.Localization (1)
LocalizedHtmlString.cs (1)
72
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
Microsoft.AspNetCore.Mvc.Razor (23)
HelperResult.cs (5)
20
/// <see cref="WriteTo(TextWriter,
HtmlEncoder
)"/> is called.</param>
21
/// <remarks>Calls to <see cref="WriteTo(TextWriter,
HtmlEncoder
)"/> result in a blocking invocation of
31
/// Gets the asynchronous delegate to invoke when <see cref="WriteTo(TextWriter,
HtmlEncoder
)"/> is called.
39
/// <param name="encoder">The <see cref="
HtmlEncoder
"/> to encode the content.</param>
40
public virtual void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
RazorPageActivator.cs (1)
34
HtmlEncoder
htmlEncoder,
RazorPageBase.cs (9)
43
private
HtmlEncoder
_htmlEncoder = default!;
120
/// Gets the <see cref="System.Text.Encodings.Web.
HtmlEncoder
"/> to use when this <see cref="RazorPage"/>
125
public
HtmlEncoder
HtmlEncoder
211
/// The <see cref="System.Text.Encodings.Web.
HtmlEncoder
"/> to use when this <see cref="RazorPage"/> handles
218
public void StartTagHelperWritingScope(
HtmlEncoder
encoder)
404
var
encoder = HtmlEncoder;
439
var
encoder = HtmlEncoder;
840
public TagHelperScopeInfo(ViewBuffer buffer,
HtmlEncoder
encoder, TextWriter writer)
849
public
HtmlEncoder
HtmlEncoder { get; }
RazorPagePropertyActivator.cs (1)
114
else if (property.PropertyType == typeof(
HtmlEncoder
))
RazorView.cs (2)
23
private readonly
HtmlEncoder
_htmlEncoder;
42
HtmlEncoder
htmlEncoder,
RazorViewEngine.cs (2)
41
private readonly
HtmlEncoder
_htmlEncoder;
52
HtmlEncoder
htmlEncoder,
TagHelpers\UrlResolutionTagHelper.cs (3)
90
public UrlResolutionTagHelper(IUrlHelperFactory urlHelperFactory,
HtmlEncoder
htmlEncoder)
107
protected
HtmlEncoder
HtmlEncoder { get; }
356
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
Microsoft.AspNetCore.Mvc.RazorPages (4)
Infrastructure\DefaultPageFactoryProvider.cs (1)
27
HtmlEncoder
htmlEncoder,
Infrastructure\PageResultExecutor.cs (3)
22
private readonly
HtmlEncoder
_htmlEncoder;
32
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/>.</param>
39
HtmlEncoder
htmlEncoder)
Microsoft.AspNetCore.Mvc.TagHelpers (23)
Cache\DistributedCacheTagHelperService.cs (3)
35
private readonly
HtmlEncoder
_htmlEncoder;
44
/// <param name="HtmlEncoder">The <see cref="
HtmlEncoder
"/> used to encode cache content.</param>
49
HtmlEncoder
HtmlEncoder,
CacheTagHelper.cs (3)
40
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/> to use.</param>
43
HtmlEncoder
htmlEncoder)
253
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
CacheTagHelperBase.cs (3)
40
public CacheTagHelperBase(
HtmlEncoder
htmlEncoder)
49
/// Gets the <see cref="System.Text.Encodings.Web.
HtmlEncoder
"/> which encodes the content to be cached.
51
protected
HtmlEncoder
HtmlEncoder { get; }
DistributedCacheTagHelper.cs (2)
32
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/>.</param>
35
HtmlEncoder
htmlEncoder)
ImageTagHelper.cs (4)
35
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/> to use.</param>
42
HtmlEncoder
htmlEncoder,
56
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/> to use.</param>
63
HtmlEncoder
htmlEncoder,
LinkTagHelper.cs (2)
101
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/>.</param>
110
HtmlEncoder
htmlEncoder,
ScriptTagHelper.cs (2)
92
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/>.</param>
101
HtmlEncoder
htmlEncoder,
TagHelperOutputExtensions.cs (4)
140
HtmlEncoder
htmlEncoder)
199
HtmlEncoder
htmlEncoder)
259
HtmlEncoder
htmlEncoder)
351
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
Microsoft.AspNetCore.Mvc.ViewFeatures (33)
AntiforgeryExtensions.cs (1)
54
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
Buffers\ViewBuffer.cs (4)
178
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
209
/// <param name="encoder">The <see cref="
HtmlEncoder
"/>.</param>
211
public async Task WriteToAsync(TextWriter writer,
HtmlEncoder
encoder)
377
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
Buffers\ViewBufferTextWriter.cs (2)
23
private readonly
HtmlEncoder
_htmlEncoder;
48
public ViewBufferTextWriter(ViewBuffer buffer, Encoding encoding,
HtmlEncoder
htmlEncoder, TextWriter inner)
Buffers\ViewBufferValue.cs (1)
51
valueAsContent.WriteTo(writer,
HtmlEncoder
.Default);
DefaultHtmlGenerator.cs (3)
41
private readonly
HtmlEncoder
_htmlEncoder;
53
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/>.</param>
60
HtmlEncoder
htmlEncoder,
HtmlHelper.cs (2)
53
private readonly
HtmlEncoder
_htmlEncoder;
66
HtmlEncoder
htmlEncoder,
HtmlHelperOfT.cs (1)
30
HtmlEncoder
htmlEncoder,
Rendering\MvcForm.cs (3)
16
private readonly
HtmlEncoder
_htmlEncoder;
24
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/>.</param>
25
public MvcForm(ViewContext viewContext,
HtmlEncoder
htmlEncoder)
Rendering\TagBuilder.cs (5)
234
private void AppendAttributes(TextWriter writer,
HtmlEncoder
encoder)
320
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
355
HtmlEncoder
encoder,
394
WriteTo(writer,
HtmlEncoder
.Default);
410
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
StringHtmlContent.cs (2)
30
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
42
WriteTo(writer,
HtmlEncoder
.Default);
ViewComponentResultExecutor.cs (3)
28
private readonly
HtmlEncoder
_htmlEncoder;
40
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/>.</param>
47
HtmlEncoder
htmlEncoder,
ViewComponents\DefaultViewComponentHelper.cs (3)
22
private readonly
HtmlEncoder
_htmlEncoder;
33
/// <param name="htmlEncoder">The <see cref="
HtmlEncoder
"/>.</param>
40
HtmlEncoder
htmlEncoder,
ViewComponents\ViewComponentContext.cs (3)
42
HtmlEncoder
htmlEncoder,
74
/// Gets or sets the <see cref="System.Text.Encodings.Web.
HtmlEncoder
"/>.
79
public
HtmlEncoder
HtmlEncoder { get; set; } = default!;
Microsoft.AspNetCore.Razor (24)
TagHelpers\DefaultTagHelperContent.cs (4)
161
public override string GetContent() => GetContent(
HtmlEncoder
.Default);
164
public override string GetContent(
HtmlEncoder
encoder)
179
public override void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
201
private static void WriteToCore(object entry, TextWriter writer,
HtmlEncoder
encoder)
TagHelpers\NullHtmlEncoder.cs (2)
10
/// A <see cref="
HtmlEncoder
"/> that does not encode. Should not be used when writing directly to a response
23
/// A <see cref="
HtmlEncoder
"/> instance that does not encode. Should not be used when writing directly to a
TagHelpers\TagHelperAttribute.cs (1)
81
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
TagHelpers\TagHelperContent.cs (3)
150
/// <param name="encoder">The <see cref="
HtmlEncoder
"/>.</param>
152
public abstract string GetContent(
HtmlEncoder
encoder);
155
public abstract void WriteTo(TextWriter writer,
HtmlEncoder
encoder);
TagHelpers\TagHelperOutput.cs (14)
14
private readonly Func<bool,
HtmlEncoder
, Task<TagHelperContent>> _getChildContentAsync;
37
/// A delegate used to execute children asynchronously with the given <see cref="
HtmlEncoder
"/> in scope and
43
Func<bool,
HtmlEncoder
, Task<TagHelperContent>> getChildContentAsync)
223
/// <see cref="
HtmlEncoder
"/>.
235
/// <see cref="
HtmlEncoder
"/>; returns cached content.
248
/// The <see cref="
HtmlEncoder
"/> to use when the page handles non-<see cref="IHtmlContent"/> C# expressions.
249
/// If <c>null</c>, executes children with the page's current <see cref="
HtmlEncoder
"/>.
253
/// This method is memoized. Multiple calls with the same <see cref="
HtmlEncoder
"/> instance will not cause
256
public Task<TagHelperContent> GetChildContentAsync(
HtmlEncoder
encoder)
266
/// If <c>true</c>, multiple calls with the same <see cref="
HtmlEncoder
"/> will not cause children to
270
/// The <see cref="
HtmlEncoder
"/> to use when the page handles non-<see cref="IHtmlContent"/> C# expressions.
271
/// If <c>null</c>, executes children with the page's current <see cref="
HtmlEncoder
"/>.
274
public Task<TagHelperContent> GetChildContentAsync(bool useCachedResult,
HtmlEncoder
encoder)
382
public void WriteTo(TextWriter writer,
HtmlEncoder
encoder)
Microsoft.AspNetCore.Razor.Runtime (11)
Runtime\TagHelpers\TagHelperExecutionContext.cs (7)
16
private readonly Action<
HtmlEncoder
> _startTagHelperWritingScope;
20
private Dictionary<
HtmlEncoder
, TagHelperContent> _perEncoderChildContent;
48
/// <see cref="
HtmlEncoder
"/> within that scope.
57
Action<
HtmlEncoder
> startTagHelperWritingScope,
199
/// Executes children asynchronously with the page's <see cref="
HtmlEncoder
" /> in scope and
227
internal async Task<TagHelperContent> GetChildContentAsync(bool useCachedResult,
HtmlEncoder
encoder)
240
_perEncoderChildContent = new Dictionary<
HtmlEncoder
, TagHelperContent>();
Runtime\TagHelpers\TagHelperScopeManager.cs (4)
22
/// <see cref="
HtmlEncoder
"/> within that scope.
26
Action<
HtmlEncoder
> startTagHelperWritingScope,
103
private readonly Action<
HtmlEncoder
> _startTagHelperWritingScope;
109
Action<
HtmlEncoder
> startTagHelperWritingScope,
Microsoft.AspNetCore.StaticFiles (6)
DirectoryBrowserMiddleware.cs (4)
25
/// Creates a new instance of the SendFileMiddleware. Using <see cref="
HtmlEncoder
.Default"/> instance.
31
: this(next, hostingEnv,
HtmlEncoder
.Default, options)
40
/// <param name="encoder">The <see cref="
HtmlEncoder
"/> used by the default <see cref="HtmlDirectoryFormatter"/>.</param>
42
public DirectoryBrowserMiddleware(RequestDelegate next, IWebHostEnvironment hostingEnv,
HtmlEncoder
encoder, IOptions<DirectoryBrowserOptions> options)
HtmlDirectoryFormatter.cs (2)
20
private readonly
HtmlEncoder
_htmlEncoder;
26
public HtmlDirectoryFormatter(
HtmlEncoder
encoder)
Microsoft.Extensions.WebEncoders (5)
EncoderServiceCollectionExtensions.cs (4)
19
/// Adds <see cref="
HtmlEncoder
"/>, <see cref="JavaScriptEncoder"/> and <see cref="UrlEncoder"/>
33
CreateFactory(() =>
HtmlEncoder
.Default,
HtmlEncoder
.Create));
43
/// Adds <see cref="
HtmlEncoder
"/>, <see cref="JavaScriptEncoder"/> and <see cref="UrlEncoder"/>
Testing\HtmlTestEncoder.cs (1)
12
/// <see cref="
HtmlEncoder
"/> used for unit testing. This encoder does not perform any encoding and should not be used in application code.
System.Text.Encodings.Web (8)
System\Text\Encodings\Web\HtmlEncoder.cs (7)
14
/// Returns a default built-in instance of <see cref="
HtmlEncoder
"/>.
16
public static
HtmlEncoder
Default => DefaultHtmlEncoder.BasicLatinSingleton;
21
/// <param name="settings">Settings used to control how the created <see cref="
HtmlEncoder
"/> encodes, primarily which characters to encode.</param>
22
/// <returns>A new instance of the <see cref="
HtmlEncoder
"/>.</returns>
23
public static
HtmlEncoder
Create(TextEncoderSettings settings)
32
/// <returns>A new instance of the <see cref="
HtmlEncoder
"/></returns>
34
public static
HtmlEncoder
Create(params UnicodeRange[] allowedRanges)
System\Text\Encodings\Web\TextEncoder.cs (1)
20
/// Instances of such subclasses can be accessed using <see cref="
HtmlEncoder
.Default"/>, <see cref="UrlEncoder.Default"/>, and <see cref="JavaScriptEncoder.Default"/>.