[Silverlight entry series] logon user authentication for businessapplication: Membership and authentication

Source: Internet
Author: User
Tags connectionstrings

Use"Silverlight business application"Template to create an application, which integrates the user login module, but the actual operation is not available, because the default is the SQL express database, Asp. net user authentication form authentication uses the membership thing. To run this application, you need to modify web. config as follows if you have a local database:

Add the membership configuration section:

< System. Web >

<! -- Config membership string -->
< Membership Defaultprovider = "Aspnetsqlmembershipprovider" >
< Providers >
< Clear />
< Add Name = "Aspnetsqlmembershipprovider"
Type = "System. Web. Security. sqlmembershipprovider"
Connectionstringname = "Localsqlserver"
Enablepasswordretrieval = "False"
Enablepasswordreset = "True"
Requiresquestionandanswer = "True"
Applicationname = "Sample application"
Requiresuniqueemail = "False"
Passwordformat = "Hashed"
Maxinvalidpasswordattempts = "5"
Minrequiredpasswordlength = "6"
Minrequirednonalphanumericcharacters = "0"
Passwordattemptwindow = "10"
Passwordstrengthregularexpression = ""   />
</ Providers >
</ Membership >

</ System. Web >

 

 

Add the database connection string connectionstring:

<! -- Configure connection string -->
< Connectionstrings >
< Clear />
< Add Name = "Localsqlserver" Providername = "System. Data. sqlclient" Connectionstring = "Persist Security info = true; Data Source = yourserver; initial catalog = yourdbname; user id = sa; Password = yourpasswd; timeout = 10" />
</ Connectionstrings >

 

Note that the keyword localsqlserver should be the same for upper and lower database connections, and applicationname should be the same.

In this way, as long as your database has a membership table, you can run it and click Register to create a new user and log on to it.

This is a simple Silverlight business application that includes user logon and logout.

For details, see Microsoft official: http://msdn.microsoft.com/en-us/library/ee942449 (V = vs.91). aspx

Asp.net authentication, membership see Microsoft official introduction: http://msdn.microsoft.com/en-us/library/yh26yfzy (vs.100). aspx

Continue next time.

 

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.