Self-Redirection Using ASP.NET

Self-redirection in ASP.NET is useful when you want to refresh your page.  You can reset a page to it’s initial state in ASP.NET by redirecting to itself. Here are 3 ways you can do it:

3 Self-Redirection Examples

  1. Response.Redirect(Request.Path);
    • The request path like the following form:
      • /MyApp/MyFile.aspx
  2. Response.Redirect(Request.RawUrl);
    • The path and any querystring parameters like the following form:
      • /MyApp/MyFile.aspx?foo=bar
  3. Response.Redirect(Request.Url.ToString());
    • The path and querystring parameters are available as an absolute reference like the following form:
      • http://MyServer/MyApp/MyFile.aspx?foo=bar

A redirect does not do a postback, as a result, I consider it a hard refresh of the page.

Scroll to Top