Redirect helper functions
public static void Redirect(string url)
{
HttpContext.Current.Response.AddHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
HttpContext.Current.Response.AddHeader("Pragma", "no-cache");
HttpContext.Current.Response.Redirect(url, false);
HttpContext.Current.Response.StatusCode = 302;
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
public static void RedirectContinue(string url)
{
HttpContext.Current.Response.AddHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
HttpContext.Current.Response.AddHeader("Pragma", "no-cache");
HttpContext.Current.Response.StatusCode = 302;
HttpContext.Current.Response.Redirect(url, false);
}
public static void RedirectPermanent(string url)
{
HttpContext.Current.Response.Redirect(url, false);
HttpContext.Current.Response.ExpiresAbsolute = DateTime.UtcNow.AddDays(1);
HttpContext.Current.Response.StatusCode = 301;
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
11300cookie-checkC# Send redirect response