How to get path argument info?

R

Rob R. Ainscough

How can I extract the path argument info in ASP.NET (using VB.NET)?

Examples

my Main.aspx form is linked using "Main.aspx?CallFrom=MyApp"

I want to be able to extract the name/value pair "CallFrom=MyApp" from
within my Main.aspx?

Is this possible?

Thanks, Rob.
 
E

Elliot M. Rodriguez

I think you want just Request.QueryString("CallFrom")...

But if you wanted the entire collection for some other reason, the
entire string is a NameValueCollection object, and you can loop through
it like you would a HashTable and get values based on keys.

Something like this (C#):
System.Collections.Specialized.NameValueCollection objQS = new
System.Collections.Specialized.NameValueCollection();

objQS = Request.QueryString;

for (int ctr = 0; ctr < objQS.Count; ctr++)
{
Response.Write("key: " + objQS.GetKey(ctr).ToString() + "<br>");
Response.Write("value: " + objQS.Get(ctr).ToString() + "<br><br>");
}

Hope that helps.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top