Problem with Server.UrlEncode

  • Thread starter Thread starter Hemant
  • Start date Start date
H

Hemant

Hi,
I am encoding a url with Server.UrlEncode. in vb.net 2005 web application
example :
Server.UrlEncode("Test URL:Test Name ")

It encode the url in Test URL%3aTest Name but this give me HTTP Error 400 -
Bad Request.

same happens for "%" character.
How to handle this
Please help me

Thanks,
Hemant
 
Hi,
I am encoding a url with Server.UrlEncode. in vb.net 2005 web application
example :
Server.UrlEncode("Test URL:Test Name  ")

It encode the url in Test URL%3aTest Name  but this give me HTTP Error 400 -
Bad Request.

same happens for "%" character.
How to handle this
Please help me

Thanks,
Hemant

Those special characters (such as colon, semi colon,etc)are not
allowed in the URL ,
see the below URL , though that is Java centric ,you could straight
away understand it.
http://www.javapractices.com/topic/TopicAction.do?Id=96
 
Hi,
I am encoding a url with Server.UrlEncode. in vb.net 2005 web
application example :
Server.UrlEncode("Test URL:Test Name ")

It encode the url in Test URL%3aTest Name but this give me HTTP Error
400 - Bad Request.

same happens for "%" character.
How to handle this
Please help me

URL encoding is used for arguments, not the actual URL. For example, you
might have a forwarder like:

http://mysite.com/forward.aspx?url=http://www.microsoft.com

Only the argument is url encoded. And, when you actually forward on
forward.aspx, you would decode before doing the response.redirect on the
url.

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

My vacation and childhood cancer awareness site:
http://www.crazycancertour.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top