1. We do not have a real server, we just rent .net2.0 + SQLserver space, and the SQL database name is fixed.
2. It is impossible for the space provider to set the data source for us or give you the aspnetdb database permissions.
3. We do not have WindowsMicrosoft.NetFrameworkv2.xConfig permissions on the server.
Knowing the above three points, if you directly transfer the locally tested project to the server, there will definitely be an error (because it calls WindowsMicrosoft.NetFrameworkv2.xConfig by default). I think a good solution is to After all the aspnetdb database contents are imported into your own remote SQL database, define the project's web.config database connection string.
web.config
<?xml version="1.0"?>
<!--
Note: Instead of manually editing this file, you can also use
Web management tool to configure the application's settings. You can use the
"Website" -> "Asp.Net Configuration" option.
A complete list of settings and annotations is at
machine.config.comments, which is usually located in
WindowsMicrosoft.NetFrameworkv2.xConfig
-->
<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 connection. This needs to be set in web.config
enablePasswordRetrieval Gets 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 users to answer a password question for password reset and retrieval.
applicationName gets or sets the name of the application.
requiresUniqueEmail Indicates whether the user must provide a unique email address value when creating the user.
passwordFormat indicates the format in which passwords are stored in the membership data store. Detailed instructions below
maxInvalidPasswordAttempts Gets the number of invalid password or invalid password answer attempts allowed before the user is locked out of membership.
minRequiredPasswordLength Gets the minimum length required for a password.
minRequiredNonalphanumericCharacters Gets the minimum number of special characters that must be included in a valid password.
passwordAttemptWindow Gets the maximum number of invalid password or invalid password answer attempts allowed before the membership user is locked out, in minutes.
Detailed description of PasswordFormat
Property indicating the format in which passwords are stored. Passwords can be stored in Clear, Encrypted, and Hashed password formats. Clear passwords are stored in clear text, which improves the performance of storing and retrieving passwords, but is less secure and can be easily read when the security of the data source is compromised. Encrypted Passwords are encrypted when stored and can be decrypted when comparing or retrieving passwords. Such passwords require additional processing during storage and retrieval, but are more secure and cannot be easily retrieved when the security of the data source is compromised. Hashed Passwords are hashed using a one-way hashing algorithm and a randomly generated salt value when stored in the database. When a password is verified, the password is hashed with the salt value in the database for verification. Unable to retrieve hashed password.
-->
<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
in the compiled page. But since this will
Affects performance, so should only be set during development
this value.
Visual Basic options:
Setting strict="true" will disable all
Type conversion with data loss.
Setting explicit="true" will force declaration of all variables.
-->
<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
secure authentication mode,
to identify the incoming user.
-->
<authentication mode="Forms" />
<!--
If an unhandled error occurs while executing the request,
The corresponding processing steps can be configured through the <customErrors> section. Specifically,
Developers can configure this section
html error page to display
to replace 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 comment on the membership node is reproduced, I forgot the address.
http://lcx.cnblogs.com/archive/2006/06/29/438836.html