URL asterisk resolution

I am having a problem with the resolution of an asterisk (*) in the URL of my website. I am running ASP.NET MVC 2 and .NET 4.0.

Here is an example that describes the problem:

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

The username is Nice *, and ASP.NET says the URL contains invalid characters:

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 tried all the methods of Web.config that I saw on the Internet, for example:

<pages validateRequest="false">

and

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

So my question is: is it possible to allow an asterisk in the url? If not, is there any coding method in .NET that can encode an asterisk (*)?

Thank!

+5
source share
3 answers

My solution was to change it to a query string.

:.

http://mysite.com/profile/?user=username *

, .

, (*) , . .

+2

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

( "*", ASCII 2A hex) ( "!", ASCII 21 hex) .

+8

(*) , URI. , URI.

"% 2A".

, , URI : http://example.com/profile/view/Nice%2A

.

URI , , .

, Qaru , URI: http://example.com/profile/view/Nice%2A

: http://example.com/profile/?user=username *

" ", .

(Sorry, I cannot demonstrate this - I am only allowed to include two links in my post.)

You can save a ton of problems by always passing percent data before embedding them in a URI.

+5
source

All Articles