I am having 2 pages name as :
- Abc.aspx
- pqr.aspx
Now on page load of Abc.aspx i am doing this:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(Request.QueryString["Alert"]))
{
if (Request.QueryString["Alert"] == "y")
{
//Here on redirection from Pqr.aspx i will display Javascript alert that your "Your data save"
}
}
else
{
//Dont do anything
}
}
}
Now from pqr.aspx page i am redirecting to Abc.aspx and passing query string on button click:
protected void Save_Click(object sender, EventArgs e)
{
//saving my data to database.
Response.Redirect("~/Abc.aspx?Alert=yes");
}
But what is happening is if anybody enters url like this in browser then still this alert is coming:
http://localhost:19078/Abc.aspx?Alert=yes
Then still this javascript alert box comes.
What i want is after redirecting from my Pqr.aspx page only this alert should come.
How to do this??
In Asp.net there is an object named
Request.UrlReferrer.With this property you can get the previous page from which you come to the current page