Comment utiliser les contrôles de connexion ASP.NET lorsque mon Login.aspx n'est pas à la racine de mon application ?

StackOverflow https://stackoverflow.com/questions/33089

  •  09-06-2019
  •  | 
  •  

Question

j'utilise le Contrôles de connexion ASP.NET et Authentification par formulaires pour l’adhésion/les informations d’identification pour une application Web ASP.NET.Il continue de rediriger vers une page Login.aspx à la racine de mon application qui n'existe pas.Ma page de connexion se trouve dans un dossier.

Était-ce utile?

La solution

Utiliser la propriété LoginUrl pour l'élément de formulaire ?

<authentication mode="Forms">
  <forms defaultUrl="~/Default.aspx" loginUrl="~/login.aspx" timeout="1440" ></forms>
</authentication>

Autres conseils

J'ai trouvé la réponse sur CoderSource.net.J'ai dû mettre le chemin correct dans mon fichier web.config.

<?xml version="1.0"?>
<configuration>
    <system.web>
        ...
        <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
        <authentication mode="Forms">
            <forms loginUrl="~/FolderName/Login.aspx" />
        </authentication>
        ...
    </system.web>
    ...
</configuration>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top