Use (Windows/form/soap/WebService) to verify user identity (including sample code download)

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.