Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Properly url encode space character

I use HttpUtility.UrlEncode to encode any value that is used in a route.

I already solved an issue with encoding forward slashes. The new problem I have now is with spaces. A space is encoded as + .

This works on the VS integrated Webserver, but I have an issue with it in IIS7 on Windows Server 2008. If I have the URL http://localhost/Home/About/asdas+sdasd

I get the error 404.11 - Request contains double escape sequence.

I know I can just replace the space by "%20", but I dont want to care about propper encoding myself. Is there any ready to use UrlEncoder for MVC out there?

like image 831
Mathias F Avatar asked Oct 30 '09 19:10

Mathias F


1 Answers

' ' encoded to %20 use HttpUtility.UrlPathEncode.

like image 127
takepara Avatar answered Sep 28 '22 17:09

takepara