Bonjour,
J'ai suivi ce tuto pour implémenter l'authentification AD multiples domaines : http://msdn.microsoft.com/en-us/library/ff650307.aspx
Pour l'instant je teste sur un seul domaine mais une partie du code me pose problème :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| // Validate the user with the membership system.
if(domainProvider.ValidateUser(UserNameTextBox.Text, PasswordTextBox.Text))
{
// If there is a RequestUrl query string attribute, the user has
// been redirected to the login page by forms authentication after
// requesting another page while not authenticated.
if (Request.QueryString["ReturnUrl"] != null)
{
// RedirectFromLoginPage sets the authorization cookie and then
// redirects to the page the user originally requested.
// Set second parameter to false so cookie is not persistent
// across sessions.
FormsAuthentication.RedirectFromLoginPage(
UserNameTextBox.Text, false);
}
else
{
// If there is no RequestUrl query string attribute, just set
// the authentication cookie. Provide navigation on the login page
// to pages that require authentication, or user can use browser
// to navigate to protected pages.
// Set second parameter to false so cookie is not persistent
// across sessions.
FormsAuthentication.SetAuthCookie(UserNameTextBox.Text, false);
}
}
else
{
Response.Write("Invalid UserID and Password");
} |
Si je n'ai pas de valeur dans
Request.QueryString["ReturnUrl"]
Je passe donc dans le code
FormsAuthentication.SetAuthCookie(UserNameTextBox.Text, false);
Le problème est ici que bien que je sois correctement authentifiée, je reste sur la page de login et un message d'erreur apparaît : Votre tentative de connexion a échoué. Réessayez.
Si je retourne à la page d'accueil, je suis pourtant bien connectée.
Auriez-vous une solution à ce problème?
Peut-être rediriger automatiquement vers la page d'accueil?
D'avance merci.
Partager