



(2 ratings)
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.20 Random Tutorials from the same category :
ASP Components
Passing Query Strings In Asp
Server Variables In ASP
Reading a Database
AIM Profile Screenname Viewer as a component of AIM Profile Designs
Displaying Server Values In ASP
Creating Databases
SQL Access Methods In ASP
Processing Form Information In ASP
Randomizer for ASP
DISPLAY DATA FROM DATABASE
Iterating through Collections In ASP
Counter in ASP
Text Editors and Software to Write ASP
Counting Visitors In ASP
Recordset Access Methods
ASP.NET Tutorial - Making image thumbnails
Server-side Scripting
ASP.NET 2 Special Purpose Folders
Searching for Matching Values














