transfering ASPNETDB.MDF Authentiocation to SQLServer

G

GaryDean

I have a 2.0 Website application in the dev environment that uses a SQL
Server 2005 DB and also uses the authentication controls and classes that
automatically use SQLServer Express. It all works fine in the dev
environment.

Now I want to deploy but I want to transfer what's in the ASPNETDB.MDF db
into my 2005 database so that I don't need to deploy SQLServer Express. I
can import those tables into my man database but I can't seem to find what
is pointing to the express database.

I've googled around but everything I've found seem to just talk around the
issue.

Anyone know how to do this? What needs to changes?

Thanks,
Gary
 
G

Guest

Hi Gary,
ASP.NET 2.0 ships with predefined SqlMembership provider which point to
local SQL Express database - you can find its declaration in machine.config
(c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config):
<membership>
<providers>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>

If you want to connect to another SQL server database you have to register
new provider instance in your web.config file:

<membership defaultProvider="SqlProvider">
<providers>
<clear />
<add connectionStringName="myConn" applicationName="/"
name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

You have to define connection string (named myConn in my example) to point
to your new database. If you are going to use full SQL 2005 you will also
need to create login for your application to allow connection to database.

Regards,
Ladislav
 
S

Steven Cheng[MSFT]

Thanks for Ladislav's informative inputs.

Hi Gary,

For your deployment scenario here, I think the following two things are
most important:

** Since SQL Server Express's database(your current mdf data file based
database ) are just a standard SQL server 2005 data file, you can simply
copy it to production server and use "attach database" operation:

#How to move SQL Server databases to a new location by using Detach and
Attach functions in SQL Server
http://support.microsoft.com/kb/224071

** You need to customize the default SQL membership provider's
connectionstring(by default point to local sqlexpress instance) or you can
add a new custom membership provider(also use the SqlMembershipProvider
class) and use your own connecticonstring to the standard SQL Server
instance:

#Examining ASP.NET 2.0's Membership, Roles, and Profile - Part 1
http://aspnet.4guysfromrolla.com/articles/120705-1.aspx

#How to Configure Your ASP.NET 2.0 Account's Membership Database
http://help.maximumasp.com/smarterticket/Customer/KBArticle.aspx?articleid=8
78

Hope this helps. If you have any further questions, welcome to post here.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


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

GaryDean

Steven,
I'm starting a new thread on this as my problems are getting worse on this
issue. Hope you can have a look.
 
S

Steven Cheng[MSFT]

Hi Gary,

Thanks for your reply.

Do you mean the following new thread you posted?

"SQL Membership Provider Problem"

No problem. I'll have a look and reply you there.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top