(2 ratings)   
By: asptutorials.net
This page describes how to get the value of URL parameters such as ?id=5432 that have been passed to your webpage in the URL, usually by a form that has been submitted. Maybe the URL requested was:
Added: 25 June 2008    Views: 552  
PathComputers    Programming    Asp
Keywords: computers   programming   language   asp   database   functions   code   coder  
Do you like this tutorial? Now you can support our team to add more :     
 
 
 

This page describes how to get the value of URL parameters such as ?id=5432 that have been passed to your webpage in the URL, usually by a form that has been submitted. Maybe the URL requested was:

http://www.mywebsite.com/MyWebPage.aspx?id=5432&size=large

What we are trying to do is to get the value of id and size, extracted out of the URL and into our application.

In fact this is very simple to do. In C# use this:

string id=Request["id"];

and in VB.net, use this:

dim id as string = Request("id")

This gets the value of the parameter named "id" from the URL. The best thing to do is to use this code in your Page_Load event handler to get the value from the variables passed to your web page.

NOTE: You can also use the slightly more verbose:

Request.QueryString("id")

which does exactly the same thing but takes longer to type!

NOTE 2: If the parameter cannot be found in the url then the method returns null.
About the Author :
asptutorials.net
 Rate this tutorial : Rate 1Rate 2Rate 3Rate 4Rate 5
  |    Add to Favorites
  |    Send to Friend
  |    Print
Comments