RE: asp.net 2.0 and sql 2005 Express aspnetdb.mdf
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.
Date:Tue, 14 Aug 2007 15:02:02 -0700
Author:
|