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