开发者

Membership information is not being saved to my modified aspnetdb

Hi I have an aspnetdb in my mvc3 application with an extra table I have create to store name and address details. When I register a user my table is being updated but the asp membership tables are not creating the user, additionally when I run the asp.net configuration it is saying that the users Im create exist but they are not in my database so they must be in another even tho this is the only database running on my server.

My config looks like this:

<connectionStrings>
<add name="ApplicationServices"
     connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
     AttachDBFilename=|DataDirectory|LJM.Models.LJMDB.mdf;User Instance=true"
     providerName="System.Data.SqlClient" />
 </connectionStrings>

<membership>
  <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider" 
         type="System.Web.Security.SqlMembershipProvider"
         connectionStringName="ApplicationServices"
         enablePasswordRetrieval="false" enablePasswordReset="true"
         requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
     开发者_运维问答    maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" 
         minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
         applicationName="/" />
  </providers>
</membership>

My Register code like this:

MembershipCreateStatus createStatus;
MembershipUser aUser = Membership.CreateUser(model.UserName, 
                                             model.Password, 
                                             model.Email,
                                             null, null, true, null,
                                             out createStatus);

model.uDetails.userid = new Guid(aUser.ProviderUserKey.ToString());
LJMDB aDB = new LJMDB();
aDB.Users.Add(model.uDetails);
aDB.SaveChanges();

if (createStatus == MembershipCreateStatus.Success) {... }

CreateStatus is a Success. I really dont understand why asp in not writing this information to my database when the connection string looks good. Any help on this or how i could find this mystery database would be really appreciated. Thanks :) JM


Try removing User Instance =true from the config?


Ok I did that but got a different error "Cannot open database requested by the login. The login failed. Login failed for user" So I changed the connection string... <configuration> <connectionStrings> <add name="ApplicationServices" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=aspnetdb;Data Source=.\SQLEXPRESS" providerName="System.Data.SqlClient" /> </connectionStrings> and everythings works now, great! and thanks :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜