Instead of using QueryString (which the user could manually enter themselves), I would recommend passing the Session variable, as shown below. I'm afraid my knowledge of C # does not exist, but here is the equivalent of VB.NET:
FirstPage.aspx
Session("mySession") = "myValue" Response.Redirect("TabTest.aspx?FireSession=1")
TabTest.aspx
If Request.QueryString("FireSession") = 1 AndAlso Session("mySession") IsNot Nothing AndAlso Session("mySession") = "myValue" Then RunMethod() End If
source share