I am trying to capture a referring URL using the following code. The redirect to the page is not working. Please help me to fix the problem.
if (!Page.IsPostBack)
{
ViewState["PreviousPage"] = Request.ServerVariables["HTTP_REFERER"];
}
protected void btnLogin_Click(object sender, EventArgs e)
{
if (ViewState["PreviousPage"] != null)
{
Response.Redirect(ViewState["PreviousPage"].ToString());
}
}
if statementis within youpage_loadeventHandler? What error msg do you get?