0
votes

I'm using the asp.net login control and a switcher to get my users to authenticate against an external database. I am now explicitly referencing my membership provider.

Using switcher:

var user = Membership.GetUser(Membership.GetUserNameByEmail(ApplicantLogin.UserName));
Membership.ValidateUser(user.UserName, ApplicantLogin.Password)

Without using a switcher:

var userName = Membership.Providers["Extranet"].GetUserNameByEmail(ApplicantLogin.UserName);
var user = Membership.Providers["Extranet"].GetUser(userName, true)
Membership.Providers["Extranet"].ValidateUser(user.UserName, ApplicantLogin.Password)

where Extranet is defined in my web config. Both examples seem to work, however, using my switcher once a user is validated and authenticated the user gets redirected to my URL defined as my DestinationPageUrl.

Without using the switcher the user gets authenticated but is not redirected for some reason. I'm not sure why this is the case.

If I do a response.redirect after the user is validated then nothing happens either. It stays on the login page.

Any help would be appreciated.

Thanks

1

1 Answers

0
votes

Are you sure that the user is being authenticated when you are not using switcher? You can debug this by implementing the OnAuthenticate Event:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.authenticate(v=vs.100).aspx

Once you are sure that the user is being properly authenticated, try implementing the LoggedIn Event and then add your Response.Redirect() call there:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.loggedin(v=vs.110).aspx