QueryString

G

Guest

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
 
G

Guest

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 + "=";
string[] valueArray = coll.GetValues(keyArray);

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

But the result is pretty much the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top