RedirectFromLoginPage and loops

G

Guest

Hi,

I've got an Intranet site that's been using the usual Forms authentication.
Now, I want to retrieve the Windows Login and authenticate the user
automatically without her typing login+password.
Thus I changed the security parameters in IIS (anonymous user unchecked,
Windows authentication checked). But I let the Forms in web.config unchanged
because I wanna keep the ReturnUrl system because I have some Session
parameters that are set at the beginning, no matter which page you use to get
in.

So, instead of checking the login;password couple is right, I just check
whether the Login Windows is valid, and then I run a RedirectFromLoginPage.
The trouble is that the page loops constantly. The RedirectFromLoginPage is
not taken into consideration whereas a debug shows it's ran. So, what's wrong?

Scheme:

My index.aspx:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Session("UserLoginIntegrated") Is Nothing Then
IntegratedConnection()
End If
End Sub



Private Sub IntegratedConnection()
Dim booUserExists As Boolean
Dim dtNew As DataTable
Dim booGo As Boolean = False
Dim returnUrl As String
Try

'Code to check whether current user is valid
' If not then display login page
' Else

Session("UserLoginIntegrated") = False
FormsAuthentication.RedirectFromLoginPage(Session.SessionID,
False)

End If
Catch ex As Exception
ErrorLogin.Text = (ex.Message)
ErrorLogin.Visible = True
Session("UserLoginIntegree") = False
Session.Clear()
Session.Abandon()
System.Web.Security.FormsAuthentication.SignOut()
End Try

End Sub

With such a code portion, the page loops moebiusly and never goes to the
requested page.

Thanks in advance,

Rob
 
G

Guest

Forms authentication requires a cookie to authenticate the user. Create a
fake cookie would be my suggestion.
 
G

Guest

hi,

thanks for your response.
Forms authentication requires a cookie to authenticate the user. Create a
fake cookie would be my suggestion.

how? because if I add
FormsAuthentication.SetAuthCookie(sEssion.sessionid,False) before the
RedirectFromLoginPage action it changes nothing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top