Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am using sitefinity and have added a login controller inside a sitefinity page(login).

When the login controller validates everytime, it fails throwing invalid credentials.

CODE:
C#
public void Login_click(object sender, EventArgs e)
 {
     if (FormsAuthentication.Authenticate(txtUserName.Text, txtPassword.Text))
     {
         lblStatus.Text = ("Welcome " + txtUserName.Text);
         FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, true);
     }
     else
     {
         lblStatus.Text = "Invalid credential.Please enter valid credentials.";
     }

 }


Is there any changes required in web.config file?

HTML
<location path="~/login">
   <system.web>
     <authorization>
       <allow users="*"/>
     </authorization>
     <compilation targetFramework="4.5"/>
   </system.web>
 </location>

 <system.web>
   <authentication mode="Forms">
       <forms name=".ASPXAUTH" loginUrl="~/login" >
         <credentials passwordFormat="Clear">
           <user name="kaplanuser" password="kaplan123"/>
           <user name="user1" password="pass123"/>
         </credentials>
       </forms>
     </authentication>
 </system.web>


What I have tried:

i commented
C#
<authentication mode="None" /> and <remove name="FormsAuthentication" />

which i doubted made authentication to fail.
Posted
Updated 11-Aug-16 0:12am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900