URL encoded text automatically decoded?

B

Ben Amada

Hello group. I'm passing URL encoded text (actually HTML) via querystring
to a webform. Part of the encoded text looks like:

... %3Cfont%20color%3D%22yellow%22%20size%3D%227%22%3E ..

However, when I put a breakpoint in my code behind and check the value of
the querystring value (Request.QueryString("text")), it shows up already
decoded. So the above text in the immediate window shows up as:

... <font color="yellow" size="7"> ..

I originally planned on using Server.URLDecode, but it seems as though .NET
is automatically decoding the HTML -- is this correct OR do I still need to
use URLDecode?

Any insights / explanations are very welcome!
Ben
 
M

Mr Newbie

To test this you should write a little loop which outputs the string to the
Output window.

Debug.write . . . .

And write character by character, this way you can be sure.
 
B

Ben Amada

Mr said:
To test this you should write a little loop which outputs the string to
the Output window.

Debug.write . . . .

And write character by character, this way you can be sure.

I'll give that a try and see what happens -- thanks!

Ben
 
B

Ben Amada

Mr said:
To test this you should write a little loop which outputs the string to
the Output window.

Debug.write . . . .

And write character by character, this way you can be sure.

Hello again,

I tested this out and found when I check each character within
Request.QueryString("text"), the HTML is showing up as decoded. Looking at
the querystring value in the address bar of the browser, it is encoded. I
guess it doesn't hurt that .NET is automatically decoding the HTML, but I
was just thrown as I didn't expect this automatic decoding to take place.

Thanks,
Ben
 
M

Mr Newbie

It makes sense really.

Glad you diagnosed it though, nothing better than proof provided by self !

Regards Mr N . . .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top