Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allowing asterisk in URL

I'm having a trouble allowing asterisk (*) in the URL of my website. I am running ASP.NET MVC 2 and .NET 4.0.

Here's an example that describes the problem:

http://mysite.com/profile/view/Nice*

The username is Nice* and ASP.NET says there are illegal characters in the URL:

Illegal characters in path.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Illegal characters in path.

I have tried all the Web.config methods I've seen online such as:

<pages validateRequest="false">

and

<httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />

So my question is: Is it possible to allow asterisk in URL? If not, is there some encoding method in .NET that can encode asterisk(*) ?

Thanks!

like image 689
Jón Trausti Arason Avatar asked Dec 31 '10 00:12

Jón Trausti Arason


1 Answers

http://www.w3.org/Addressing/URL/4_URI_Recommentations.html

Other reserved characters

The asterisk ("*", ASCII 2A hex) and exclamation mark ("!" , ASCII 21 hex) are reserved for use as having special signifiance within specific schemes.

like image 147
turtlepick Avatar answered Oct 06 '22 20:10

turtlepick