472,985 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,985 software developers and data experts.

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

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 1905

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

Similar topics

by: dale zhang | last post by:
Hi groups, Can anyone give me the equivalent C# sharp code for this VB.ET code, :: VB.NET :: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles...
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has...
by: Ravindra | last post by:
Hi, Im trying to use Response.Redirect in Session_End event in Global.asax page, which is not working. Why this is not working? And if this not works here, how do I hanlde this? Any possible and...
by: Stimp | last post by:
I need to take my website offline for an hour or so while I perform some maintenance... is it possible to create a 'catch-all' redirect to a temporary page (i.e. something in Web.config or...
by: Tod Birdsall, MCSD for .NET | last post by:
Hi All, I have two ASP.NET applications which I am trying to have share forms authentication. But I am running into problems. App A is an ASP.NET 2.0 Beta 2 application. App B is an ASP.NET...
by: John A Grandy | last post by:
I installed VS05 RC , created a new Web Site , but I do not see Global.asax , and I do not see Global.asax.cs in the App_Code dir ......
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
by: Mark Rae | last post by:
http://msdn.microsoft.com:80/vstudio/support/vs2005sp1/default.aspx 1) This is big - nearly 500Mb 2) If you have WAP installed, you must uninstall it first - WDP doesn't need to be uninstalled...
by: shamirza | last post by:
What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.