Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Special Characters in Query String

Reply
Thread Tools

Special Characters in Query String

 
 
SMG - Idealake
Guest
Posts: n/a
 
      05-20-2005
Hi All,
I have created an application which is working fine and is in about to
launch, now suddenly my mgmt says there are chances that Scrip ID( a
particular id and not prim key) may have special characters like '&,*,) or
/'

This data(field/key) I am passing this value as a querystring. e.g.

value to be passed : ABC
http://localhost/myProj/abc.aspx?ScripID=ABC
this works fine,

But when I have special characters like [ABC&D] then the value retrieved is
wrong it just retrieves ABC and not complete ID [ABC&D]
value to be passed : ABC&D
http://localhost/myProj/abc.aspx?ScripID=ABC&D

how do I overcome this, I know I can do it like we have %20 for space and
like wise for & there will be something, but this will be a major change to
my application, can I do this at one end some where in web.config or in aspx
page?

P.S. Hi Juan T. Llibre,
if you have cracked that things, can you mail me to http://www.velocityreviews.com/forums/(E-Mail Removed)
id please.

Thanks and best regards,
Shailesh Gajare


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      05-20-2005
Use Server.UrlEncode(string)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"SMG - Idealake" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi All,
> I have created an application which is working fine and is in about to
> launch, now suddenly my mgmt says there are chances that Scrip ID( a
> particular id and not prim key) may have special characters like '&,*,) or
> /'
>
> This data(field/key) I am passing this value as a querystring. e.g.
>
> value to be passed : ABC
> http://localhost/myProj/abc.aspx?ScripID=ABC
> this works fine,
>
> But when I have special characters like [ABC&D] then the value retrieved
> is
> wrong it just retrieves ABC and not complete ID [ABC&D]
> value to be passed : ABC&D
> http://localhost/myProj/abc.aspx?ScripID=ABC&D
>
> how do I overcome this, I know I can do it like we have %20 for space and
> like wise for & there will be something, but this will be a major change
> to
> my application, can I do this at one end some where in web.config or in
> aspx
> page?
>
> P.S. Hi Juan T. Llibre,
> if you have cracked that things, can you mail me to
> (E-Mail Removed)
> id please.
>
> Thanks and best regards,
> Shailesh Gajare
>
>



 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      05-20-2005
Give this a try. It shouldn't be a big change as QueryString decodes this
automatically for you. You'll have just to encode the values using
Server.URLEncode.

I don't think you can do better as the system has no way to know
automatically that the & you have is part of the value instead of being
taken as a separator (you have to tell this by encoding the value)...

You could try a test such as :
Response.Write (Request.QueryString("MyVar"))
Response.Write("<a href="""?MyVar=" &
Server.URLEncode("MyValue&/*WithSomeCharacters") & """>Test</a>")

Patrice

--

"SMG - Idealake" <(E-Mail Removed)> a crit dans le message de
news:(E-Mail Removed)...
> Hi All,
> I have created an application which is working fine and is in about

to
> launch, now suddenly my mgmt says there are chances that Scrip ID( a
> particular id and not prim key) may have special characters like '&,*,) or
> /'
>
> This data(field/key) I am passing this value as a querystring. e.g.
>
> value to be passed : ABC
> http://localhost/myProj/abc.aspx?ScripID=ABC
> this works fine,
>
> But when I have special characters like [ABC&D] then the value retrieved

is
> wrong it just retrieves ABC and not complete ID [ABC&D]
> value to be passed : ABC&D
> http://localhost/myProj/abc.aspx?ScripID=ABC&D
>
> how do I overcome this, I know I can do it like we have %20 for space and
> like wise for & there will be something, but this will be a major change

to
> my application, can I do this at one end some where in web.config or in

aspx
> page?
>
> P.S. Hi Juan T. Llibre,
> if you have cracked that things, can you mail me to

(E-Mail Removed)
> id please.
>
> Thanks and best regards,
> Shailesh Gajare
>
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      05-20-2005
re:
> P.S. Hi Juan T. Llibre,
> if you have cracked that things, can you mail me to (E-Mail Removed) id please.


SMG,

What Jorg and I are working on regards file encoding.
Your problem relates to query string encoding.

The answer to the problem Jorg and I are working on will not
help you solve the problem you're having with query string encoding.

In any case, there will be at least a 2 week delay, since I'm going on an
11 day trip starting today and won't be able to work on this in the meantime.

Jorg and I will post the resolution to the file encoding problem
as soon as we finish the analysis ( which is fairly complex... ).




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================

"SMG - Idealake" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi All,
> I have created an application which is working fine and is in about to
> launch, now suddenly my mgmt says there are chances that Scrip ID( a
> particular id and not prim key) may have special characters like '&,*,) or
> /'
>
> This data(field/key) I am passing this value as a querystring. e.g.
>
> value to be passed : ABC
> http://localhost/myProj/abc.aspx?ScripID=ABC
> this works fine,
>
> But when I have special characters like [ABC&D] then the value retrieved is
> wrong it just retrieves ABC and not complete ID [ABC&D]
> value to be passed : ABC&D
> http://localhost/myProj/abc.aspx?ScripID=ABC&D
>
> how do I overcome this, I know I can do it like we have %20 for space and
> like wise for & there will be something, but this will be a major change to
> my application, can I do this at one end some where in web.config or in aspx
> page?
>
> P.S. Hi Juan T. Llibre,
> if you have cracked that things, can you mail me to (E-Mail Removed)
> id please.
>
> Thanks and best regards,
> Shailesh Gajare
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert between a string w/ backslashes and a string w/special characters? Peng Yu Perl Misc 3 07-13-2010 05:48 AM
How to pass special characters through query string ? Sobin Thomas ASP General 5 05-21-2008 01:22 PM
How to convert HTML special characters to the real characters with a Java script Stefan Mueller HTML 3 07-23-2006 10:09 PM
Special Characters in Query String SMG ASP .Net 20 05-25-2005 11:45 AM
Special Characters in passed Query String Sunshine Valdes ASP General 2 09-11-2003 10:34 PM



Advertisments