问题
This is in continuation to my last question (ASP.net Custom membership on top of quality center authorization)
developing asp.net application to provide an customized interface to HP's Quality center(QC). Its login page will use QC'a API for authenticating a user. Also have a SQL database in which I store the QC users who have registered to my application (just store QC user id's in DB, not password, password authentication is done using QC API).
like in QC, my login page, has 2 sets of control,
1. UserID and Password textboxes -
User enters UserID and Password and clicks 'Authenticate' - on click, I check is user is inmy DB and if found, the provided credentials are validated using QC API
2. QC Domain and Project dropdown lists - once user is authenticated in step 1, QC domains and projects to which user has access to, are pulled using QC API and populated in respective dropdown lists.
User selects domain/project and clicks login button. On click of login button, I want to set Set FormAuthentication cookie and redirect user to a page say - welcome.aspx in 'Authenticated' directory.
The issue -
After clicking the 'login' button in step 2, when I call "FormsAuthentication.RedirectFromLoginPage", its coming back to Login page instead of going to welcome.aspx.
below is my web.config:
<authentication mode="Forms">
<forms name=".AutoCenterAuth" loginUrl="~/Login.aspx" defaultUrl="~/authenticated/welcome.aspx" protection="None" timeout="30" requireSSL="false" slidingExpiration="true" cookieless="UseCookies" enableCrossAppRedirects="false"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
..
..
<location path="Authenticated">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
and below is the code behind in login.aspx's Login button on click:
Private Sub btn_LoginToAC_Click(ByVal sender As Object,
ByVal e As System.Web.UI.ImageClickEventArgs) Handles btn_LoginToAC.Click
objQCSession = Session("QCUserSession")
'FormsAuthentication.SetAuthCookie(objQCSession.UserName, False)
FormsAuthentication.RedirectFromLoginPage(objQCSession.UserName, True)
End Sub
scratching my head for past one day to figure out what's wrong or if I missed anything, but to no success so far, any help is greatly appreciated.
来源:https://stackoverflow.com/questions/15722718/formsauthentication-redirectfromloginpage-keeps-looping