1) Implementation of Windows Integrated Identity Authentication
1. Description:
Windows Authentication uses existing Windows Account Information for authentication.
IIS automatically provides identity authentication, which is more secure than custom identity authentication, but not flexible.
Applicable to internal Web ApplicationsProgram.
Configure in Web. config: <Authentication mode = "Windows"/>
2.CodeDownload example:
Http://www.cnitblog.com/Files/ChengKing/WindowsAuth.rar
(2). Form Authentication
1. Description: use form-based authentication. Configure in Web. config:
<Authentication mode = "forms">
<Forms name = ". aspxcookiedemo"
Protection = "all"
Loginurl = "login. aspx"
Timeout = "20"
Path = "/">
<Credentials passwordformat = "clear">
<User name = "chengking" Password = "123"/>
</Credentials>
</Forms>
</Authentication>
<User name = "chengking" Password = "123"/> configures User Logon Information
Obtain the data in the Code as follows:
If (formsauthentication. Authenticate (txtuser. Text, txtpwd. Text ))
{
Formsauthentication. redirectfromloginpage (txtuser. Text, false );
}
Else
{
Errmsg. Text = "credential error. Please enter it again ";
}
2. Download the sample code:
Http://www.cnitblog.com/Files/ChengKing/FormsAuth.rar
(3) identity authentication using soap
1. Description
Customize a soaphead storage user name and password.
Public class soapauthheader: soapheader
{
Public String username;
Public String userpwd;
}
It is relatively simple to call WebService for input verification. For more information, see the sample code.
2. Download the sample code:
Http://www.cnitblog.com/Files/ChengKing/SoapAuth0.rar
(4). Use WebService for Identity Authentication
1. Description
Call the WebService Method for Identity Authentication
2. Download Sample Code
Http://www.cnitblog.com/Files/ChengKing/WebAuth.rar
Note the following when running the downloaded code:
For ease of input and account unification, the above four sample code examples can correctly log on to the account:
Userid: chengking
Passward: 123