473,799 Members | 2,868 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 2621
Request.QuerySt ring.ToString() will return all of them.

bill
"hecsan07" <he******@hotma il.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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.htmNRMOD E=Published&NRO RIGINALURL=%2fb score%2ftopmove rs%2fdefault.ht m&NRNODEGUID=%7 b428F5151-FE96-49B9-9178-8F1A9D59A316%7d &NRCACHEHINT=Mo difyLoggedIn"

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 NameValueCollec tion object.
NameValueCollec tion coll = Request.QuerySt ring;

// 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.Leng th; j++)
{
redirectTo += valueArray[j];
}
}

But the result is pretty much the same.

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

bill
"hecsan07" <he******@hotma il.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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/ ....ModifyLogge dIn.

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.UrlEncod e( valueArray[j] );

bill

"hecsan07" <he******@hotma il.com> wrote in message
news:15******** *************** ***********@mic rosoft.com...
I tried that but it returns something that looks like this:

"/bscore/topmovers/_hpc/_1/016305.htmNRMOD E=Published&NRO RIGINALURL=%2fb scor
e%2ftopmovers%2 fdefault.htm&NR NODEGUID=%7b428 F5151-FE96-49B9-9178-8F1A9D59A3
16%7d&NRCACHEHI NT=ModifyLogged In"
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 NameValueCollec tion object.
NameValueCollec tion coll = Request.QuerySt ring;

// 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.Leng th; j++)
{
redirectTo += valueArray[j];
}
}

But the result is pretty much the same.

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

bill
"hecsan07" <he******@hotma il.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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
17291
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=<%= Request.QueryString("cplace") %>">Click</a> Suppose the names in the above querystring have the following values: cname="Danny" cadd1="House 97"
2
2095
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 string that is not shopped off? Thanks Mike
1
6751
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: popup.html?pImage=30_leilani_dowding_b_060.jpg&ordRef=1000&Title=Leilani&nbsp;Dowding using the QueryString function below, the pImage variable should be
5
5199
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
19754
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 appear in the url anymore. How can I get rid of it? A postback doesn't clear it, it just keeps tagging along. I tried Request.QueryString.Clear, but get "readonly" errors. I want to do this, because eventually I use server.transfer within this...
12
5293
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 ... www.something.com/main.aspx?client Client is the QueryString, but no value is given. This would mean to me that client exists, so its value is true. In the code behind, I can tell that client exists using Request.QueryString.Keys.Count, which equals 1....
3
3134
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 that I can check for the existance of a parameter value in that previous querystring.
1
5984
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 before loading the thankyou page. This is completed. NOw on the thankyou.aspx page i am getting the following error: Compiler Error Message: CS0120: An object reference is required for the nonstatic field, method, or property...
4
5966
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) { if ( Request.QueryString.Count 0 ) { if ( Request.QueryString != "" )
3
2161
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 must be submitted with a unique key, while everything is the same, these 4 fields must be different.... Idealy, these are the codes. please teach me how to do it. objConn.Open(sConnection) sRowNum = request.querystring("row_num")
0
9689
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10032
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7573
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4148
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 we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.