473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Special Characters in URL, how to handle?

SMG
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?

Regards,
Shailesh Gajare
Nov 19 '05 #1
4 3145
If you are passing it as a query string, you must escape it (%XX).
Another option it to "post" to the form. It will be automatically taken
care of by the browser and runtime (escaping and unescaping).
--
Cheers,
Gaurav Vaish
http://mastergaurav.blogspot.com
http://mastergaurav.org
-------------------------

Nov 19 '05 #2
Continuing from previous message:

Instead of
<a href="...?ScripID=ABC&D>Link
do a:

<form name="someName" action="abc.aspx" method="post">
<input type="hidden" name="ScripID" value="ABC&D">
<a href="javascript:someName.submit()">Link</a>
</form>

--
Cheers,
Gaurav Vaish
http://mastergaurav.blogspot.com
http://mastergaurav.org
-------------------------

Nov 19 '05 #3
SMG
Thanks Gaurav,
that means if I have five such type of links on the page either I have
to create 5 different forms or a single form which encorporate these links.
and If I have 500 - 600 pages with such links then what.

Isn't there some simple way?

Don't we have some thing in web.config?

I added following code in web.config file, still it functions the same way.

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

Any help?

Regards,
Shailesh Gajare
"MasterGaurav" <ga**********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Continuing from previous message:

Instead of
<a href="...?ScripID=ABC&D>Link
do a:

<form name="someName" action="abc.aspx" method="post">
<input type="hidden" name="ScripID" value="ABC&D">
<a href="javascript:someName.submit()">Link</a>
</form>

--
Cheers,
Gaurav Vaish
http://mastergaurav.blogspot.com
http://mastergaurav.org
-------------------------
Nov 19 '05 #4
SMG,

You can encode/decode the URLs with the
respective URL methods ( URLencode/URL.decode ),
Dim text As String = "Juan's Link!"
Response.Write("<a href='some.aspx?id=" & Server.UrlEncode(text) & "'>Go There</a>")

but you will *not* be able to use neither "&" nor "=" nor "?"
in your URLs because those are *reserved* characters,
unless you escape them.

See : http://www.ietf.org/rfc/rfc2396.txt
Section 2.2. Reserved Characters


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

"SMG" <SM*@nodmain.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
Thanks Gaurav,
that means if I have five such type of links on the page either I have
to create 5 different forms or a single form which encorporate these links.
and If I have 500 - 600 pages with such links then what.

Isn't there some simple way?

Don't we have some thing in web.config?

I added following code in web.config file, still it functions the same way.

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

Any help?

Regards,
Shailesh Gajare
"MasterGaurav" <ga**********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Continuing from previous message:

Instead of
<a href="...?ScripID=ABC&D>Link
do a:

<form name="someName" action="abc.aspx" method="post">
<input type="hidden" name="ScripID" value="ABC&D">
<a href="javascript:someName.submit()">Link</a>
</form>

--
Cheers,
Gaurav Vaish
http://mastergaurav.blogspot.com
http://mastergaurav.org
-------------------------

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: thomasamillergoogle | last post by:
I am building a xml file to store a single TCP/IP raw packet. I need to store "special characters" on the file I am working on. When I say "special characters" i am talking about tabs,...
1
by: quickcur | last post by:
I am rewrite some of my excel sheets to xml document. In my excel, there is a lot of special characters like "/", " " (space), "#", "+'. I am using a java program based on JDom to to create xml....
5
by: Jain, Pranay Kumar | last post by:
Hello Everyone, I have written a simple app. that converts the dataset into excelspreadsheet. The App. uses the following architecture. First it generates the dataset with corresponding...
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
17
by: Carl Mercier | last post by:
Hi, Is it possible to use special characters like \n or \t in a VB.NET string, just like in C#? My guess is NO, but maybe there's something I don't know. If it's not possible, does anybody...
8
by: eugenio | last post by:
Hi...not sure if this is the right group for this posting, but i'm don't know where else to post. I've got a simple problem...I have a linux box running apache 2.0 and php5. I'm trying to use the...
25
by: Wim Cossement | last post by:
Hello, I was wondering if there are a few good pages and/or examples on how to process form data correctly for putting it in a MySQL DB. Since I'm not used to using PHP a lot, I already found...
5
by: Alex | last post by:
Hi all - Is there a standard way to handle special chars in strings in dotnet? I'm using csharp and having two seperate problems... 1. Passing in args... I need to pass in an arg that...
3
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.