For the first time. net2.0 Login Login Control Puzzles and solutions _ Practical Tips

Source: Internet
Author: User
Tags stack trace connectionstrings

1, we do not have a real server, we just rented the. net2.0 + SQL Server space, the SQL database name is fixed.
2, space provider can not give us the data source or give you ASPNETDB database permissions.
3, we do not have the \Windows\Microsoft.Net\Framework\v2.x\Config permissions of the server.

Given the above three points, it would be a mistake to upload a locally tested project directly to the server (because he calls \Windows\Microsoft.Net\Framework\v2.x\Config by default), I think a good solution is to aspnetdb the contents of the database into its own remote SQL database, and then define the project's Web.config database connection string.
Web.config
<?xml version= "1.0"?>

<!--
Note: In addition to manually editing this file, you can also use the
WEB Administration Tool to configure settings for your application. Can be used in Visual Studio
The Web site-> the asp.net configuration option.
The complete list of settings and comments is
Machine.config.comments, this file is typically located in the
In \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns= "http://schemas.microsoft.com/.NetConfiguration/v2.0" >
<connectionStrings>

<!--define database connection-->
<add name= "dbname" connectionstring= "Persist security info=false;server=127.0.0.1;database=aspnetdb;uid=sa;pwd= 123;pooling=true "/>

</connectionStrings>
<appSettings>

</appSettings>

<system.web>

    <!--
    connectionstringname database connections. This is to be set in the Web.config
    enablePasswordRetrieval to obtain a value indicating whether the current membership provider is configured to allow users to retrieve their passwords.
    enablePasswordReset Gets a value indicating whether the current membership provider is configured to allow users to reset their passwords.
    requiresQuestionAndAnswer Gets a value that indicates whether the default membership provider requires the user to answer a password question when a password reset and retrieval occurs.
    ApplicationName Gets or sets the name of the application.
    requiresUniqueEmail Indicates whether a user must provide a unique e-mail address value when creating a user. The
    passwordformat indicates the format in which passwords are stored in the membership data store. The following is a detailed description of
    maxinvalidpasswordattempts get the number of invalid password or invalid password answer attempts allowed before the lock membership user. The
    minrequiredpasswordlength gets the minimum length required for the password.
    minRequiredNonalphanumericCharacters Gets the minimum number of special characters that must be contained in a valid password.
    passwordAttemptWindow Gets the number of minutes of the maximum number of invalid password or invalid password answer attempts allowed before the membership user is locked out.

A detailed description of the Passwordformat
property indicates the format in which the password is stored. Passwords can be stored in clear, Encrypted, and hashed password formats. Clear passwords are stored in plaintext, which improves the performance of storing and retrieving passwords, but is less secure and can be easily read when data source security is compromised. Encrypted passwords are encrypted when stored, and can be decrypted when a password is compared or retrieved. Such passwords require additional processing when they are stored and retrieved, but are more secure and are not easily accessible when the security of the data source is compromised. The hashed password is hashed using a one-way hash algorithm and a randomly generated salt value when it is stored in the database. When a password is validated, the password is hashed with the salt value in the database for verification. The hash password could not be retrieved.
-->


<rolemanager enabled= "true"/>
<membership>
<providers>
<remove name= "AspNetSqlMembershipProvider"/>
<add name= "AspNetSqlMembershipProvider"
Type= "System.Web.Security.SqlMembershipProvider, system.web, version=2.0.0.0, Culture=neutral, publickeytoken= B03F5F7F11D50A3A "
Connectionstringname= "DBName"
Enablepasswordretrieval= "false"
Enablepasswordreset= "true"
Requiresquestionandanswer= "true"
Applicationname= "/"
Requiresuniqueemail= "false"
Passwordformat= "Hashed"
Maxinvalidpasswordattempts= "5"
Minrequiredpasswordlength= "6"
minrequirednonalphanumericcharacters= "0"
passwordattemptwindow= "10"
Passwordstrengthregularexpression= ""/>
</providers>
</membership>


<!--
Set compilation debug= "True" to insert debug symbols
Pages that have been compiled. But since this will
affect performance and should only be set during the development process
This value.

Visual Basic Options:
Setting strict= "True" will prohibit all causes
Type conversions for data loss.
Setting explicit= "True" will force all variables to be declared.
-->
<compilation debug= "true" strict= "false" explicit= "true"/>
<pages>
<namespaces>
<clear/>
<add namespace= "System"/>
<add namespace= "System.Collections"/>
<add namespace= "System.Collections.Specialized"/>
<add namespace= "System.Configuration"/>
<add namespace= "System.Text"/>
<add namespace= "System.Text.RegularExpressions"/>
<add namespace= "system.web"/>
<add namespace= "System.Web.Caching"/>
<add namespace= "System.Web.SessionState"/>
<add namespace= "System.Web.Security"/>
<add namespace= "System.Web.Profile"/>
<add namespace= "System.Web.UI"/>
<add namespace= "System.Web.UI.WebControls"/>
<add namespace= "System.Web.UI.WebControls.WebParts"/>
<add namespace= "System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authentication> section allows you to configure the asp.net used by
Secure authentication Mode,
To identify the incoming user.
-->
<authentication mode= "Forms"/>
<!--
If an unhandled error occurs during the execution of the request,
The <customErrors> section allows you to configure the appropriate processing steps. Specifically
The section enables developers to configure
HTML error page to display
In place of the error stack trace.

<customerrors mode= "RemoteOnly" defaultredirect= "genericerrorpage.htm" >
<error statuscode= "403" redirect= "noaccess.htm"/>
<error statuscode= "404" redirect= "filenotfound.htm"/>
</customErrors>
-->

</system.web>
</configuration>

Note: The annotation of the membership node is reproduced and forgot the address.

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.