Link to home
Start Free TrialLog in
Avatar of SweatCoder
SweatCoderFlag for United States of America

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of jitganguly
jitganguly

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jitganguly
jitganguly

Why C?
Avatar of SweatCoder

ASKER

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.
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 https://www.experts-exchange.com/Community_Support/
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.
Thank you