getting query info in a url

J

Jeff

ASP.NET 2.0

I'm wondering how I can get a specific parameter in the query string in a
url. I have this url in my website:
Default.aspx?mode=1 So I'm wondering how I can the "mode" parameter and its
value.

I've seached the documentation I came across Uri.Query which returns the
entire query list in one single string (that is how I understand it). What
I'm looking for is method/property which returns the parameters as a
collection (name/value collection)

Any suggestions?
 
J

Jeff

Strange but just a few seconds after posting this question I came across
what I was looking for:
HttpRequest.QueryString
 
M

MasterGaurav \(www.edujini-labs.com\)

I'm wondering how I can get a specific parameter in the query string in a
url. I have this url in my website:
Default.aspx?mode=1 So I'm wondering how I can the "mode" parameter and
its value.

Multiple ways:

1. Request.QueryString["mode"]
2. Request["mode"]

However, note that while doing Request["mode"], we are looking at various
places at one go:
1. QueryString
2. Form-Data
3. Cookies
4. Headers


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
 
J

John Timney \(MVP\)

Just to help you bit more. Request is an namevaluecollection object in
asp.net and represents a set of objects you can query. As a collection it
can be iterated

The QueryString you have found on your own but there are other properties of
the request object that are equally useful, such as the Form,
ServerVariables, and Cookie collections.

Its worth reading a little about page execution to learn where various
elements become exposed.
http://msdn2.microsoft.com/en-us/library/aa479007.aspx

--
--
Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top