RE: How to create the first user in the Membership database




Thanks for your reply Dave,

Yes, I did have investigated the connectionstring part when I tried it
previously. Unfortunately, the SqlMembershipProvider always use the
configuration setting to get the connectionstring, therefore we can not
directly supply a connectionstring on the fly. Also, if you haven't
initially created the aspnetdb.mdf file through aspnet_regsql.exe (or SQL
SMO....), and want to let the Sqlmembershipprovider automatically create it
and install those services databases, you have to use the default
SQLExpress connection string as below:

"connectionString="data source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
Instance=true"


So what I would suggest is use the default "LocalSqlServer"
connectionstring(since it is already in machine.config file). Thus, it will
locate an aspnetdb.mdf file under the "App_Data" sub directory of our
application(exe)'s directory. After create the users, you can move it to
the target place.

For the roleManager provider, I'll perform some further research, I'll also
consult some other engineers about the connectionstring issue. I'll update
you if there is any new information.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no rights.

.