Redirect to another page and preserve any passed parameters.

protected void Page_Init(object sender, System.EventArgs e)
{
 //Redirect to another page and preserve any passed parameters.
 string ThisPageUrl = Request.RawUrl;
 string ThisPageFile = IO.Path.GetFileName(Request.Path);
 string RedirectPageFile = "RedirectPage.aspx";
 string RedirectPageUrl = ThisPageUrl.Replace(ThisPageFile, RedirectPageFile);
 Response.Redirect(RedirectPageUrl);
}

No comments:

Post a Comment