473,320 Members | 2,088 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,320 software developers and data experts.

QueryString Parameter Substitution

ASP.net Framework 2 IIS 6 Win 2003

Is it possible to substitute the & (ampersand) in a querystring for antother
value i.e

test.com?param1=test;param2=notest

instead of &(ampersand) can i use ; (semicolon)

--
Thanks
Richard
May 4 '06 #1
2 1744
According to the URI RFC, ; is an allowed separator. According to W3C
standards, it's recommended for browsers to support ; as well incase the
author needs a lot of & they don't want to encode
(http://www.w3.org/TR/1999/REC-html40...s.html#h-B.2.2)

Looking inside the .NET framework, the parser seems to have '&' hardcoded.
So you'll need to write your own. A simple version might just use the Split
function:

if (Request.Url.Query.Length > 0)
{
string parts[] = Request.Url.Query.Substring(1,
Request.Url.Query.Length-1).Split(';', '&');
//loop through parts and dump it into your own NameValueCollection if
you want..
}

Karl
--
http://www.openmymind.net/

"Richard Steele" <Ri***********@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
ASP.net Framework 2 IIS 6 Win 2003

Is it possible to substitute the & (ampersand) in a querystring for
antother
value i.e

test.com?param1=test;param2=notest

instead of &(ampersand) can i use ; (semicolon)

--
Thanks
Richard

May 4 '06 #2
I posted a more complete solution at:
http://codebetter.com/blogs/karlsegu...04/144052.aspx

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2****************@TK2MSFTNGP05.phx.gbl...
According to the URI RFC, ; is an allowed separator. According to W3C
standards, it's recommended for browsers to support ; as well incase the
author needs a lot of & they don't want to encode
(http://www.w3.org/TR/1999/REC-html40...s.html#h-B.2.2)

Looking inside the .NET framework, the parser seems to have '&' hardcoded.
So you'll need to write your own. A simple version might just use the
Split function:

if (Request.Url.Query.Length > 0)
{
string parts[] = Request.Url.Query.Substring(1,
Request.Url.Query.Length-1).Split(';', '&');
//loop through parts and dump it into your own NameValueCollection if
you want..
}

Karl
--
http://www.openmymind.net/

"Richard Steele" <Ri***********@discussions.microsoft.com> wrote in
message news:36**********************************@microsof t.com...
ASP.net Framework 2 IIS 6 Win 2003

Is it possible to substitute the & (ampersand) in a querystring for
antother
value i.e

test.com?param1=test;param2=notest

instead of &(ampersand) can i use ; (semicolon)

--
Thanks
Richard


May 4 '06 #3

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

Similar topics

6
by: John Wilkin | last post by:
I'm using an xsl stylesheet to transform an xml source from a remote URL. I'm using the xslt.pl processor available from "http://www.dopscripts.com/doc/description.html". The remote URL is...
1
by: MrMike | last post by:
I have a DataGrid Hyperlink column as shown here. I'm trying to pass the JobNum parameter as shown. The JobNum parameter is the webform's Request.Querystring("JobNum"). I can't find out how to...
3
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so...
5
by: CharlesA | last post by:
Hi folks, I'm having a discussion with my colleague about how to go about passing data from one aspx page to another example On the main page I have a whole list of relationship managers with a...
6
by: Mehdi | last post by:
Hi, I get the following URL on page load: http://www.server1.com?RedirectUrl=http://www.server2.com?id=777 So QueryString will return (after cleaning up via URL Encode/decode) :...
11
by: pamelafluente | last post by:
Hi I am executing some simple sample code: Using OleDbCommand As New OleDbCommand(Me.DBQuery.Text, Me.OleDbConnection) Dim OleDbParameter As OleDbParameter =...
0
by: mohaaron | last post by:
Hello all, I'm having a problem using the ReturnUrl parameter while using FormsAuthentication. If I already have some querystring parameters in the url like this. ...
2
by: Carlos | last post by:
Hi all, I would like to have a page that checks for an optional parameter being passed. I use the request.querystring("myvar") when the parameter is being passed, but when the parameter is...
2
by: Doogie | last post by:
Hi, I'm writing Javascript code to parse out a query string. I want to handle the case where a parameter value may not be sent. So consider a parameter called "State". If the user doesn't pass...
0
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.