我正在以编程方式创建一个新用户(稍后将添加自定义配置文件)并且正在使用 Win2K8 VM:
MembershipUser newUser =
Membership.CreateUser(userNameTxt.Text, passwordTxt.Text, emailTxt.Text);
Roles.AddUserToRole(userNameTxt.Text.Trim(), "Member");
更新:
连接字符串:
<remove name="LocalSqlServer" />
<add name="LocalSqlServer"
connectionString="Initial Catalog=MYS;Data Source=WIN2K8;uid=MYS;password=xxxxxx;"
providerName="System.Data.SqlClient" />
收到以下错误:
System.Data.SqlClient.SqlException:用户 'IIS APPPOOL\MYAPP' 登录失败。
<membership>
<providers>
<remove name="DefaultMembershipProvider"/>
<add
name="DefaultMembershipProvider"
type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<roleManager enabled="true">