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.