Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
here is URL which I want to encode
http://www.xyz.com/band/pra.nam
As last word contains '.', after opening this page it shows error like
"HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
Though I have used URL Encoding using Server.UrlEncode("MyURL"); this method.
It is running perfectly for other special characters but it shows above error for '.'
Its not replacing '.' by '%2E'
Please help
Thanks in advance
Posted
Comments
sashje- 30-Sep-15 3:56am    
Are you sure that the Web Server handles the .nam extension? IIS f.ex does not allow you to access unknown filetypes. So you either need to add a handler to that extension or you need to specify a mime-type for the extension
Ankita1391 30-Sep-15 4:30am    
Got it.
thanks
I have added UrlRoutingHandler to web.config.It resolved my problem to some extent.
But I still want to know why Server.UrlEncode() not resolving '.' to '%2E'? It doesn't make any difference
sashje- 30-Sep-15 5:29am    
It's because UrlEncode calls a method method called IsSafe() within System.Web.Utility, where the "a-> z", "A-> Z", "0->9" aswell as "\' ( ) * - . _ !" are considered Safe characters within an url.. all other will be encoded by it hexadecimal value

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900