Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

login control

$
0
0

Hello

I've defined user name and password for admin in web.cofig :

<system.web><authentication mode="Forms"><forms name="SavingsPlan" defaultUrl="admin.aspx" loginUrl="Login.aspx" ><credentials passwordFormat="SHA1"><user name="admin"
                  password="7712757"/></credentials></forms></authentication><authorization><allow users="*"/><deny users="?"/></authorization></system.web><location path="Admin.aspx"><system.web>
<authorization>

<allow roles="Administrator"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

and place a login control on the my admin page:



public partial class login : System.Web.UI.Page
{
    
    protected bool authenthicate(String name,String password)
    {
        if(name == "admin")
        {
            if (password == "7712757")
                return true;
        }
        return false;
    }
   public void onLogin(String name,String password)
    {
       if(authenthicate(name,password))
       {
           FormsAuthentication.RedirectFromLoginPage( );

       }
       else
       {
           Response.Write("Invalid user name or password");
       }
    }   
}

but it isn't working.

Can you please inform me where is wrong in my code?

thanks

Saeed


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>