4 types derived from HtmlEncoder
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
DefaultEditorTemplates.cs (1)
487private sealed class PassThroughHtmlEncoder : HtmlEncoder
Microsoft.AspNetCore.Razor (1)
TagHelpers\NullHtmlEncoder.cs (1)
13public sealed class NullHtmlEncoder : HtmlEncoder
Microsoft.Extensions.WebEncoders (1)
Testing\HtmlTestEncoder.cs (1)
14public sealed class HtmlTestEncoder : HtmlEncoder
System.Text.Encodings.Web (1)
System\Text\Encodings\Web\DefaultHtmlEncoder.cs (1)
11internal sealed class DefaultHtmlEncoder : HtmlEncoder
167 references to HtmlEncoder
Aspire.Dashboard (1)
Model\Assistant\Markdown\ResourceInlineRenderer.cs (1)
16var encodedResourceName = HtmlEncoder.Default.Encode(inline.ResourceName);
Microsoft.AspNetCore.Components.Endpoints (9)
RazorComponentEndpointInvoker.cs (2)
161htmlContent.WriteTo(bufferWriter, HtmlEncoder.Default); // Don't use WriteToAsync, as per the comment above 180componentStateHtmlContent.WriteTo(bufferWriter, HtmlEncoder.Default);
Rendering\EndpointHtmlRenderer.Prerendering.cs (3)
344WriteTo(writer, HtmlEncoder.Default); 348await _dispatcher.InvokeAsync(() => WriteTo(writer, HtmlEncoder.Default)); 352public void WriteTo(TextWriter writer, HtmlEncoder encoder)
Rendering\EndpointHtmlRenderer.PrerenderingState.cs (1)
215public void WriteTo(TextWriter writer, HtmlEncoder encoder)
Rendering\EndpointHtmlRenderer.Streaming.cs (2)
225writer.Write(HtmlEncoder.Default.Encode(message)); 255writer.Write(HtmlEncoder.Default.Encode(OpaqueRedirection.CreateProtectedRedirectionUrl(httpContext, destinationUrl)));
Results\RazorComponentResultExecutor.cs (1)
82htmlContent.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)
45protected HtmlEncoder HtmlEncoder { get; set; } = HtmlEncoder.Default;
src\aspnetcore\src\Shared\RazorViews\BaseView.cs (2)
48protected HtmlEncoder HtmlEncoder { get; set; } = HtmlEncoder.Default;
Microsoft.AspNetCore.Hosting (2)
src\aspnetcore\src\Shared\RazorViews\BaseView.cs (2)
48protected HtmlEncoder HtmlEncoder { get; set; } = HtmlEncoder.Default;
Microsoft.AspNetCore.Html.Abstractions (9)
HtmlContentBuilder.cs (2)
157public void WriteTo(TextWriter writer, HtmlEncoder encoder) 183WriteTo(writer, HtmlEncoder.Default);
HtmlFormattableString.cs (4)
55public void WriteTo(TextWriter writer, HtmlEncoder encoder) 68WriteTo(writer, HtmlEncoder.Default); 82private readonly HtmlEncoder _encoder; 87public EncodingFormatProvider(IFormatProvider formatProvider, HtmlEncoder encoder)
HtmlString.cs (1)
38public 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> 19void WriteTo(TextWriter writer, HtmlEncoder encoder);
Microsoft.AspNetCore.Identity (2)
IdentityApiEndpointRouteBuilderExtensions.cs (2)
217await emailSender.SendPasswordResetCodeAsync(user, resetRequest.Email, HtmlEncoder.Default.Encode(code)); 418await emailSender.SendConfirmationLinkAsync(user, email, HtmlEncoder.Default.Encode(confirmEmailUrl));
Microsoft.AspNetCore.Mvc.Localization (1)
LocalizedHtmlString.cs (1)
72public 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> 40public virtual void WriteTo(TextWriter writer, HtmlEncoder encoder)
RazorPageActivator.cs (1)
34HtmlEncoder htmlEncoder,
RazorPageBase.cs (9)
43private HtmlEncoder _htmlEncoder = default!; 120/// Gets the <see cref="System.Text.Encodings.Web.HtmlEncoder"/> to use when this <see cref="RazorPage"/> 125public HtmlEncoder HtmlEncoder 211/// The <see cref="System.Text.Encodings.Web.HtmlEncoder"/> to use when this <see cref="RazorPage"/> handles 218public void StartTagHelperWritingScope(HtmlEncoder encoder) 404var encoder = HtmlEncoder; 439var encoder = HtmlEncoder; 840public TagHelperScopeInfo(ViewBuffer buffer, HtmlEncoder encoder, TextWriter writer) 849public HtmlEncoder HtmlEncoder { get; }
RazorPagePropertyActivator.cs (1)
114else if (property.PropertyType == typeof(HtmlEncoder))
RazorView.cs (2)
23private readonly HtmlEncoder _htmlEncoder; 42HtmlEncoder htmlEncoder,
RazorViewEngine.cs (2)
41private readonly HtmlEncoder _htmlEncoder; 52HtmlEncoder htmlEncoder,
TagHelpers\UrlResolutionTagHelper.cs (3)
90public UrlResolutionTagHelper(IUrlHelperFactory urlHelperFactory, HtmlEncoder htmlEncoder) 107protected HtmlEncoder HtmlEncoder { get; } 356public void WriteTo(TextWriter writer, HtmlEncoder encoder)
Microsoft.AspNetCore.Mvc.RazorPages (4)
Infrastructure\DefaultPageFactoryProvider.cs (1)
27HtmlEncoder htmlEncoder,
Infrastructure\PageResultExecutor.cs (3)
22private readonly HtmlEncoder _htmlEncoder; 32/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> 39HtmlEncoder htmlEncoder)
Microsoft.AspNetCore.Mvc.TagHelpers (23)
Cache\DistributedCacheTagHelperService.cs (3)
35private readonly HtmlEncoder _htmlEncoder; 44/// <param name="HtmlEncoder">The <see cref="HtmlEncoder"/> used to encode cache content.</param> 49HtmlEncoder HtmlEncoder,
CacheTagHelper.cs (3)
40/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/> to use.</param> 43HtmlEncoder htmlEncoder) 253public void WriteTo(TextWriter writer, HtmlEncoder encoder)
CacheTagHelperBase.cs (3)
40public CacheTagHelperBase(HtmlEncoder htmlEncoder) 49/// Gets the <see cref="System.Text.Encodings.Web.HtmlEncoder"/> which encodes the content to be cached. 51protected HtmlEncoder HtmlEncoder { get; }
DistributedCacheTagHelper.cs (2)
32/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> 35HtmlEncoder htmlEncoder)
ImageTagHelper.cs (4)
35/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/> to use.</param> 42HtmlEncoder htmlEncoder, 56/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/> to use.</param> 63HtmlEncoder htmlEncoder,
LinkTagHelper.cs (2)
101/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> 110HtmlEncoder htmlEncoder,
ScriptTagHelper.cs (2)
92/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> 101HtmlEncoder htmlEncoder,
TagHelperOutputExtensions.cs (4)
140HtmlEncoder htmlEncoder) 199HtmlEncoder htmlEncoder) 259HtmlEncoder htmlEncoder) 351public void WriteTo(TextWriter writer, HtmlEncoder encoder)
Microsoft.AspNetCore.Mvc.ViewFeatures (33)
AntiforgeryExtensions.cs (1)
54public void WriteTo(TextWriter writer, HtmlEncoder encoder)
Buffers\ViewBuffer.cs (4)
178public void WriteTo(TextWriter writer, HtmlEncoder encoder) 209/// <param name="encoder">The <see cref="HtmlEncoder"/>.</param> 211public async Task WriteToAsync(TextWriter writer, HtmlEncoder encoder) 377public void WriteTo(TextWriter writer, HtmlEncoder encoder)
Buffers\ViewBufferTextWriter.cs (2)
23private readonly HtmlEncoder _htmlEncoder; 48public ViewBufferTextWriter(ViewBuffer buffer, Encoding encoding, HtmlEncoder htmlEncoder, TextWriter inner)
Buffers\ViewBufferValue.cs (1)
51valueAsContent.WriteTo(writer, HtmlEncoder.Default);
DefaultHtmlGenerator.cs (3)
41private readonly HtmlEncoder _htmlEncoder; 53/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> 60HtmlEncoder htmlEncoder,
HtmlHelper.cs (2)
53private readonly HtmlEncoder _htmlEncoder; 66HtmlEncoder htmlEncoder,
HtmlHelperOfT.cs (1)
30HtmlEncoder htmlEncoder,
Rendering\MvcForm.cs (3)
16private readonly HtmlEncoder _htmlEncoder; 24/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> 25public MvcForm(ViewContext viewContext, HtmlEncoder htmlEncoder)
Rendering\TagBuilder.cs (5)
234private void AppendAttributes(TextWriter writer, HtmlEncoder encoder) 320public void WriteTo(TextWriter writer, HtmlEncoder encoder) 355HtmlEncoder encoder, 394WriteTo(writer, HtmlEncoder.Default); 410public void WriteTo(TextWriter writer, HtmlEncoder encoder)
StringHtmlContent.cs (2)
30public void WriteTo(TextWriter writer, HtmlEncoder encoder) 42WriteTo(writer, HtmlEncoder.Default);
ViewComponentResultExecutor.cs (3)
28private readonly HtmlEncoder _htmlEncoder; 40/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> 47HtmlEncoder htmlEncoder,
ViewComponents\DefaultViewComponentHelper.cs (3)
22private readonly HtmlEncoder _htmlEncoder; 33/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> 40HtmlEncoder htmlEncoder,
ViewComponents\ViewComponentContext.cs (3)
42HtmlEncoder htmlEncoder, 74/// Gets or sets the <see cref="System.Text.Encodings.Web.HtmlEncoder"/>. 79public HtmlEncoder HtmlEncoder { get; set; } = default!;
Microsoft.AspNetCore.Razor (24)
TagHelpers\DefaultTagHelperContent.cs (4)
161public override string GetContent() => GetContent(HtmlEncoder.Default); 164public override string GetContent(HtmlEncoder encoder) 179public override void WriteTo(TextWriter writer, HtmlEncoder encoder) 201private 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)
81public void WriteTo(TextWriter writer, HtmlEncoder encoder)
TagHelpers\TagHelperContent.cs (3)
150/// <param name="encoder">The <see cref="HtmlEncoder"/>.</param> 152public abstract string GetContent(HtmlEncoder encoder); 155public abstract void WriteTo(TextWriter writer, HtmlEncoder encoder);
TagHelpers\TagHelperOutput.cs (14)
14private readonly Func<bool, HtmlEncoder, Task<TagHelperContent>> _getChildContentAsync; 37/// A delegate used to execute children asynchronously with the given <see cref="HtmlEncoder"/> in scope and 43Func<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 256public 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"/>. 274public Task<TagHelperContent> GetChildContentAsync(bool useCachedResult, HtmlEncoder encoder) 382public void WriteTo(TextWriter writer, HtmlEncoder encoder)
Microsoft.AspNetCore.Razor.Runtime (11)
Runtime\TagHelpers\TagHelperExecutionContext.cs (7)
16private readonly Action<HtmlEncoder> _startTagHelperWritingScope; 20private Dictionary<HtmlEncoder, TagHelperContent> _perEncoderChildContent; 48/// <see cref="HtmlEncoder"/> within that scope. 57Action<HtmlEncoder> startTagHelperWritingScope, 199/// Executes children asynchronously with the page's <see cref="HtmlEncoder" /> in scope and 227internal 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. 26Action<HtmlEncoder> startTagHelperWritingScope, 103private readonly Action<HtmlEncoder> _startTagHelperWritingScope; 109Action<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> 42public DirectoryBrowserMiddleware(RequestDelegate next, IWebHostEnvironment hostingEnv, HtmlEncoder encoder, IOptions<DirectoryBrowserOptions> options)
HtmlDirectoryFormatter.cs (2)
20private readonly HtmlEncoder _htmlEncoder; 26public HtmlDirectoryFormatter(HtmlEncoder encoder)
Microsoft.Extensions.WebEncoders (5)
EncoderServiceCollectionExtensions.cs (4)
19/// Adds <see cref="HtmlEncoder"/>, <see cref="JavaScriptEncoder"/> and <see cref="UrlEncoder"/> 33CreateFactory(() => 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"/>. 16public 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> 23public static HtmlEncoder Create(TextEncoderSettings settings) 32/// <returns>A new instance of the <see cref="HtmlEncoder"/></returns> 34public 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"/>.