Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2043
  • Last Modified:

URLEncode in asp.net

The Server.URLEncode method in classic asp worked great: it only encoded invalid url characters, producing a legal url string.

The URLEncode method I found for asp.net behaves strangely: it encodes EVERY character (maybe except for alphanumeric chars. . .??) in a url, even the legal ones.

so the following illegal url SHOULD be coded as

bad: http://www.google.com/my special folder/my page.html
good: http://www.google.com/my%20special%20folder/my%20page.html

the .net version even encodes the forward slashes (legal in url), so the resulting url is *wrong*

So: Is there a method in .net that behaves exactly like classic asp's Server.URLEncode() method?
0
SweatCoder
Asked:
SweatCoder
  • 4
  • 2
1 Solution
 
jitgangulyCommented:
Why C?
0
 
SweatCoderAuthor Commented:
no offense intended. . .

but you just gave me a single link with no explanation. i gave you the points. i feel that an 'A' should go to a carefully constructed and explained answer.

anyway, i had already tried what that link suggests, and maybe i had just implemented it wrong.

i'm not giving the C as a slap in the face, i'm just giving it to reflect the effort required to cut and paste a link, little effort needed.

anyway, the question was simple, and i suppose it warrants a simple answer.

sorry if that bugged you. i guess i should have given an 'A'. my bad. i'll change it if there's a way. I was thinking "C" = Average, not "C" = Crap.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
jitgangulyCommented:
If something does not work, you could always ask me. 'C' is an insult to me. Sorry you are balcklisted unless you ask CS to change it http://www.experts-exchange.com/Community_Support/
0
 
SweatCoderAuthor Commented:
didn't mean to insult. i'm new at EE so i'm not up on the culture. i'll request to have it changed.
0
 
jitgangulyCommented:
Thank you
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now