470,849 Members | 1,228 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

ASP.NET: CSS disappear after redirect from Global.asax

18
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?
May 15 '08 #1
0 1799

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

14 posts views Thread by dale zhang | last post: by
8 posts views Thread by Andreas Klemt | last post: by
8 posts views Thread by Stimp | last post: by
1 post views Thread by Tod Birdsall, MCSD for .NET | last post: by
4 posts views Thread by John A Grandy | last post: by
29 posts views Thread by Mark Rae | last post: by
reply views Thread by shamirza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.