Using HTTP Parameters with C# and .NET

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I have a question as below:
.. one.htm calls two.aspx page with parameter as below:
.. two.aspx?para1=hello
.. in two.aspx.cs file, how do I use the parameter?
Please advice.
 
Peter -

This is how you would access parameters passed through the querystring:

Request.Querystring("para1")

Hope this helps.

Bart A. Robinson, MCP
 
In the Page_Load function, you can read this value into a local variable.
Eg.

string strParam = "Default Value";

if (Request.QueryString.Get("para1") != string.Empty)
{
strParam = Request.QueryString.Get("para1")
}

Hope this helps,

Mun
 
Back
Top