473,508 Members | 2,040 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

QueryString

I am a newbie in .NET. I am trying to collect the query string and paste it
to the new url. The problem is I am not sure with the particular names of the
query string elements are. How can I iterate through the QueryString
collection and copy the values to the URL?
Please help me with some code examples.

HS
Nov 19 '05 #1
3 2579
Request.QueryString.ToString() will return all of them.

bill
"hecsan07" <he******@hotmail.com> wrote in message
news:FE**********************************@microsof t.com...
I am a newbie in .NET. I am trying to collect the query string and paste it to the new url. The problem is I am not sure with the particular names of the query string elements are. How can I iterate through the QueryString
collection and copy the values to the URL?
Please help me with some code examples.

HS

Nov 19 '05 #2
I tried that but it returns something that looks like this:

"/bscore/topmovers/_hpc/_1/016305.htmNRMODE=Published&NRORIGINALURL=%2fbscore %2ftopmovers%2fdefault.htm&NRNODEGUID=%7b428F5151-FE96-49B9-9178-8F1A9D59A316%7d&NRCACHEHINT=ModifyLoggedIn"

I am afraid this is not the right URL. I am not much of an expert, but the
..htm is repeated over several times there. I don't fully understand the %
signs neither, but I guess that relates to the path in my pc.

I tried this:

// Load NameValueCollection object.
NameValueCollection coll = Request.QueryString;

// Get names of all keys into a string array.
string[] keyArray = coll.AllKeys;

for (int i = 0; i < keyArray.Length; i++)
{
redirectTo += keyArray[i] + "=";
string[] valueArray = coll.GetValues(keyArray[i]);

for (int j = 0; j < valueArray.Length; j++)
{
redirectTo += valueArray[j];
}
}

But the result is pretty much the same.

"William F. Robertson, Jr." wrote:
Request.QueryString.ToString() will return all of them.

bill
"hecsan07" <he******@hotmail.com> wrote in message
news:FE**********************************@microsof t.com...
I am a newbie in .NET. I am trying to collect the query string and paste

it
to the new url. The problem is I am not sure with the particular names of

the
query string elements are. How can I iterate through the QueryString
collection and copy the values to the URL?
Please help me with some code examples.

HS


Nov 19 '05 #3
The % are url encoded values.

What did your original url look like?

http://server.com/bob.aspx?/bscore/topmovers/_hpc/ ....ModifyLoggedIn.

If so, then that is correct, it is isn't, then there is something deeper
here.

Your loop looks pretty good, but when you are using the last for loop
stepping through your values, you should have

redirectTo += Server.UrlEncode( valueArray[j] );

bill

"hecsan07" <he******@hotmail.com> wrote in message
news:15**********************************@microsof t.com...
I tried that but it returns something that looks like this:

"/bscore/topmovers/_hpc/_1/016305.htmNRMODE=Published&NRORIGINALURL=%2fbscor
e%2ftopmovers%2fdefault.htm&NRNODEGUID=%7b428F5151-FE96-49B9-9178-8F1A9D59A3
16%7d&NRCACHEHINT=ModifyLoggedIn"
I am afraid this is not the right URL. I am not much of an expert, but the
.htm is repeated over several times there. I don't fully understand the %
signs neither, but I guess that relates to the path in my pc.

I tried this:

// Load NameValueCollection object.
NameValueCollection coll = Request.QueryString;

// Get names of all keys into a string array.
string[] keyArray = coll.AllKeys;

for (int i = 0; i < keyArray.Length; i++)
{
redirectTo += keyArray[i] + "=";
string[] valueArray = coll.GetValues(keyArray[i]);

for (int j = 0; j < valueArray.Length; j++)
{
redirectTo += valueArray[j];
}
}

But the result is pretty much the same.

"William F. Robertson, Jr." wrote:
Request.QueryString.ToString() will return all of them.

bill
"hecsan07" <he******@hotmail.com> wrote in message
news:FE**********************************@microsof t.com...
I am a newbie in .NET. I am trying to collect the query string and
paste it
to the new url. The problem is I am not sure with the particular names
of the
query string elements are. How can I iterate through the QueryString
collection and copy the values to the URL?
Please help me with some code examples.

HS


Nov 19 '05 #4

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

Similar topics

3
17278
by: Arpan | last post by:
A link has the following URL: <a href="Page1.asp?cname=<%= Request.QueryString("cname") %>&cadd1=<%= Request.QueryString("cadd1") %>&cadd2=<%= Request.QueryString("cadd2") %>&cplace=<%=...
2
2082
by: Mikael | last post by:
Hi All! I have a problem here and i can't see what it is... My parameters (value) are shopped off. exampe "Hello world" will end up like "hello" How should i adjust the syntax to get a whole...
1
6725
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string:...
5
5181
by: David | last post by:
Hello I need to take some values and place them in a string in the format of a querystring. Lets say I have: string State = "ACT"; string SearchString = "Tax"; int MinRelevance = 50;
4
19705
by: Raterus | last post by:
Howdy, Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to...
12
5276
by: Alex | last post by:
I have a question about determining if one QueryString keys exists. The idea is, if this key exists, than its presence is enough to indicate that its value is true. For example ... ...
3
3116
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...
1
5976
by: beebee | last post by:
Hi all. I am having a bit of difficulty: Here is what is happening: I have an application that spits out a thankyou.aspx page and i would like to pass it the querystring values it had collected...
4
5950
by: =?Utf-8?B?RVcgTmV3Ymll?= | last post by:
My apologies in advance if there is a better forum for this question. Given the following snippet: <script type="text/c#" runat="server"> protected void Page_Load(Object Sender, EventArgs e)...
3
2147
by: pingsheng | last post by:
Dear all, I have a form with dynamically created input fields. These fields go to next page for submitting into SQL database. The thing is all fields are the same but 4 fields. So each record...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.