Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / August 2007

Tip: Looking for answers? Try searching our database.

asp.net 2.0 and sql 2005 Express aspnetdb.mdf

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DB - 08 Aug 2007 03:10 GMT
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
Wes Clyburn - 14 Aug 2007 23:02 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.