asp.net 2.0 and sql 2005 Express aspnetdb.mdf

D

DB

I have a web application that I have a dilema in trying to publish it to my
isp. The problem stands as is... the database is created in the default
aspnetdb.mdf file on my local machine and I can not create a database using
the same name (I guess for security reasons) on the shared hosting server
when I do I get a message that one already exists. I am new to dynamic
development and 3 tier websites I'm hoping that I can find a workaround
concerning this matter
 
W

Wes Clyburn

You'll need to edit your web.config with an appropriate connection string
pointing to your database. It's very likely that your host does not even run
SQL Express on the web server, and so local databases are not possible.

<connectionStrings>
<add name="SiteSqlServer" connectionString="Data
Source=****;Initial Catalog=******;User ID=******;Password=****"
providerName="System.Data.SqlClient"/>
</connectionStrings>

In addition, you'll need to make sure that each provider your application
uses this connection. If you do nothing to them at all, then they'll use
their default settings... which will make them try to use aspnetdb and fail.

For example, if you're using membership, then you'll need to add a section
to configure it like this:

<!-- Customized to use the connectionStringName configured above -->
<membership defaultProvider="CustomizedMembershipProvider">
<providers>
<add name="CustomizedMembershipProvider"
connectionStringName="siteSqlServer"
applicationName="Yourappname"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

You're still using the same SqlMembershipProvider that would be used without
this section, but you're giving it the correct attributes.

You'll need to do this for every provider your app uses (except
SiteMapProvider, which uses a file by default): Profile, Personalization,
Role...

The ASP.NET Admin Tool will honor this configuration when you launch it from
your IDE, too.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top