Url with special char #

I need to show in the browser some files that contain this # in the name. Using it on url, the file seems inaccessible.

How do I configure IIS or my web.config to allow this?

thanks Andrea

+3
source share
3 answers

This is not how URLs work.

The symbol is #used to indicate the hash part; anything after it is not sent to the server.

You need to avoid #how%23

+9
source

Use the URLEncode method to encode the file name for the query string

As already mentioned, the # character is a special character for bookmarking a page

+3
source

You need UrlEncode file name when creating the url. This avoids the "#" character, allowing the browser to interpret it accordingly.

Proper encoding is very important to prevent Cross-Site Scripting attacks on your application, which can be disruptive.

+2
source

All Articles