Search

Error in documentation for HttpServerUtility.UrlPathEncode by OwyheeRover

Closed
as By Design Help for as By Design

2
0
Sign in
to vote
Type: Bug
ID: 551839
Opened: 4/16/2010 8:43:28 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
The documenation for HttpServerUtility.UrlPathEncode at http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.urlpathencode.aspx says

Characters such as a question mark (?), ampersand (&), slash mark (/), and spaces might be truncated or corrupted by some browsers. As a result, these characters must be encoded in <a> tags or in query strings where the strings can be re-sent by a browser in a request string.

To me, this says that question marks are encoded, especially those inside <a> tags. Yet the example given, and real-life practice, show that the question mark is not encoded.

Details (expand)

Product Language

English

Visual Studio Version

Visual Studio 2010

Operating System

Windows 7

Operating System Language

English

Steps to Reproduce

Dim txt As String
txt = "<a href='ab cd?ef gh'/>"
txt = HttpUtility.UrlPathEncode(tx)

Actual Results

<a%20href='ab%20cd?ef gh'/>

Note that neither the question mark nor the following space are encoded. This post is only about what the documentation says about the question mark inside an <a> tag, which should be encoded. The following space issue has been reported separately

Expected Results

<a%20href='ab%20cd%3fef%20gh'/>

Question mark inside <a> tag is encoded.
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey.

 

File Attachments
0 attachments
Sign in to post a comment.
Posted by OwyheeRover on 4/27/2010 at 11:45 AM
Please add to the documentation of UrlPathEncode to include a discussion of UrlEncode. Note that this would then be consistent with the documentation for UrlEncode, which does discuss UrlPathEncode. However, currently, if one reads about UrlPathEncode, they would not readily understand that perhaps they should also learn about UrlEncode.

Thanks.
Posted by Microsoft on 4/27/2010 at 10:34 AM
UrlPathEncode has historically only Url encoded values < 0x20 or >= 0x7F. It also includes logic that first splits the input string on '?' since it assumes everything after the '?' is a query-string that has already been encoded.

UrlEncode is more aggressive than UrlPathEncode and will Url encode characters like '?'. The UrlEncode method also doesn't make any assumptions about embedded '?' having any significance.

Thank you for submitting your issue on Connect.
Posted by Microsoft on 4/18/2010 at 10:51 PM
Thanks for your feedback. We were able to reproduce the issue you are seeing. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 4/18/2010 at 10:51 PM
Thanks for your feedback. We were able to reproduce the issue you are seeing. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 4/18/2010 at 10:51 PM
Thanks for your feedback. We were able to reproduce the issue you are seeing. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Sign in to post a workaround.