Check whether Querystring is available or not.
Now , i am going to explain how to check Whether the Querystring is present or available or not.
For ex: I am passing id as a querystring to the page2.aspx from page1.aspx.
So on Page1.aspxError : Object Reference Exception.Button1_Clickevent() Response.Redirect("page2.aspx?id=1",false); Then on Page2.aspx Page2_Loadevent() If(!IsPostback) { If(!String.ISNullOrEmpty(Request.QueryString["id"])) { // get the value of Querstring id , if id is not null or empty } else if(!String.ISNullOrEmpty(Request.QueryString["name"])) { // get the value of name querystring if name is not null or empty } } When you run the above code - ie: on Page2.aspx you can get the id Querystring value. this works fine.Suppose if you pass some other querystring name ex: name from the Page1.aspx the above code givesie: Button2_Clickevent()Response.Redirect("page2.aspx?name=Dotnet",false);
Page2_Loadevent()If(!IsPostback) { if(Request.QueryString["id"] != null) { If(!String.ISNullOrEmpty(Request.QueryString["id"])) { // get the value of Querstring id , if id is not null or empty } } if ((Request.QueryString["name"] != null) { if(!String.ISNullOrEmpty(Request.QueryString["name"])) { // get the value of name querystring if name is not null or empty } } }