August 13, 2012

How to redirect page?

Suppose I am browsing Orders.aspx without login to that website using any credentials, web authenticator treated me as ? user so it redirect me to login page back. After login successfully how can I redirect to my past location from which this redirectional process occurred?

var redirectUrl = Request.QueryString["ReturnUrl"]; 

if (redirectUrl != null)
{
Response.Redirect(redirectUrl, false);
}
else
{
Response.Redirect("Home.aspx");
}