title: Redirects with Global.asax file in C#
body: <p>I have added the following code to my Global.asax file:</p>
  
  <pre><code> &lt;%@ Application Language="C#" %&gt;
  
   &lt;script runat="server"&gt;
  
  protected void Application_BeginRequest(Object sender, EventArgs e)
  {
      if (ConfigurationManager.AppSettings["IsReviewServer"] == "Yes")
      {
          if (!Request.IsSecureConnection)
          {
              string path = string.Format("https{0}", Request.Url.AbsoluteUri.Substring(4));
  
              Response.Redirect(path);
          }
      }
  }
  
  void Application_Start(object sender, EventArgs e) 
  {
      // Code that runs on application startup
  
  }
  
  etc.....
  </code></pre>
  
  <p>But my BeginRequest function just gets ignored. How do I redirect my entire application from http: to https:?</p>