Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FormsAuthentication in infinte redirect loop

Status
Not open for further replies.

tcstom

Programmer
Aug 22, 2003
235
GB
I was using Windows authentication in a ASP.NET 1.1 intranet app I'm writing. Now trying to change to FormsAuthentication which I believe I've set up correctly. The problem is that the login creates a user object then calls...
Code:
FormsAuthentication.RedirectFromLoginPage(thisUser.Name, false);
When debugging, what happens is that my default.aspx page is processed but when stepping through with the debugger it gets to the end of the Page_Load method and jumps straight back to the top causing an infinite loop. There are no redirects in default.aspx and Request.IsAuthenticated is true. My web.config holds this:
Code:
<authentication mode="Forms">
		<forms loginUrl="login.aspx" />
    </authentication>
    <authorization>
        <deny users="?" />
	</authorization>

Would appreciate some help. No way to debug this because there is no line of code that is explicitly causing the loop... HELP!
 
I've looked into this further. What is happening is that the FormAuthentication valdidates the login successfully and redirects to the appropriate ReturnUrl, but when it gets to that page (any page) the Page_Load runs, but at some point between Page_Load finishing and Page_PreRender starting the application is trying to redirect to default.aspx. I've removed all references to default.aspx in my code so this redirection must be automated, but why is it happening?
 
thats strange,

have you set up any HttpModules in your application???

Known is handfull, Unknown is worldfull
 
No. I'm an idiot. Had a user control that was doing the redirection. My debugger wasn't stepping into the user control hence my confusion. Still, there I was blaming Microsoft and it turned out it was programmer error again!
 
he he...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top