Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strPath As String = HttpContext.Current.Request.Path()
Dim cookie As HttpCookie = HttpContext.Current.Request.Cookies("MyCookieName" )
' Handle if cookie not exist
If cookie Is Nothing Then
' Redirect to login page if cookie doesn't exist
If (strPath.ToLower.Contains("login.aspx") = False) Then
HttpContext.Current.Response.Redirect("login.aspx" )
End If
End If
End Sub
----
I have a simple website with a default.aspx page and login.aspx. I attempt to create a global.asax file which check to if cookie exist for current user at application begin request. If cookie doesn't exist, then redirect to the login.aspx page. It seems to work and redirect to the login.aspx page as intended except after being redirected from global.asax, all cascade style of the login.aspx disappears. All code needed for the css are there, I just can't understand why css it doesn't apply to the page. Anyone encounter similar issue? It there any setting require in order to use global.asax?