troubleshooting Question

Global.asax Infinite Redirect Loop Issue

Avatar of cat4larry
cat4larry asked on
.NET Programming
3 Comments1 Solution846 ViewsLast Modified:
I'm making some changes to my Forms Authentication to support authentication across multiple applications on the same server.   Anyway, I've always had the below code in my Global.asax file:

           
If Session("UserID") Is Nothing Then
                    'we have an authenticated user
                    'with no current session
                    'so lets do this
                    'let's remove their authentication ticket
                    'then redirect them to logon.aspx
                    FormsAuthentication.SignOut()
                    Response.Redirect("Login.aspx")
                End If

Basically I use it so that any authenticated user without a session will be redirected back to the login page.  However, this same code is now causing an infinite redirect looping problem. (in google chrome it says "This webpage has a redirect loop").  As soon as I comment the code out I don't have the issue.  And more mysteriously, it only happens in DeBug mode

1) Do I even need this code?  As soon as the session expires doesn't that also mean the auth ticket expired?  Therefore all the redirecting will be handled by the built in forms authentication?

2) Why would it only be causing an issue in DeBug mode?

Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros