dotnet / dotnet/dotnet-api-docs

Two examples for each override of HtmlEncode incorrectly encode the (Space) character

Open
#10,378 5 comments 0 reactions 0 assignees View on GitHub
area-System.Web Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

### Type of issue

Code doesn't work

### Description

Two of the code examples given for [HtmlEncode(String, Boolean)](https://learn.microsoft.com/en-us/dotnet/api/system.web.security.antixss.antixssencoder.htmlencode?view=netframework-4.8#system-web-security-antixss-antixssencoder-htmlencode(system-string-system-boolean)) and for [HtmlEncode(String, TextWriter)](https://learn.microsoft.com/en-us/dotnet/api/system.web.security.antixss.antixssencoder.htmlencode?view=netframework-4.8#system-web-security-antixss-antixssencoder-htmlencode(system-string-system-io-textwriter)) incorrectly encode the (Space) character.

|Code Example | Incorrect Encoding| Correct Encoding |
|----------------|----------------|------------------|
|alert('XSS Attack!'); |` alert('XSS Attack!');`|`alert('XSS Attack!');`|
|"Anti-Cross Site Scripting Namespace"| `"Anti-Cross Site Scripting Namespace"` | `"Anti-Cross Site Scripting Namespace"` |

### Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.web.security.antixss.antixssencoder.htmlencode?view=netframework-4.8

### Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Web.Security.AntiXss/AntiXssEncoder.xml

### Document Version Independent Id

6789ad2b-05d7-e3fe-97b3-27e6ce8d971f

### Article author

@Rick-Anderson

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.