Global.asax error - Request not available in this context

Discussion in 'ASP.NET / ASP.NET Core' started by gater, Apr 3, 2011.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I get the error with this code...

    Code:
    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
            ' Code that runs on application startup
            If HttpContext.Current.Request.IsSecureConnection.Equals(False) Then
                Response.Redirect("https://" + Request.ServerVariables("HTTP_HOST") + HttpContext.Current.Request.RawUrl)
            End If
        End Sub
    how can I fix this? I've tried to reload the page. the site works when I comment out the code, but I get the error when I try to use it.
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    what error?
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page