Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 4th, 2007, 01:27 AM
Registered User
 
Join Date: Feb 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to point Login tool to hosted database?


How do I tell the Login tool to use the membership information from my hosted database instead of my local copy? I can set the connection string for all other services, and I ran the config tool to set up all the tables on my remote db, and have switched over to Forms authentication, but I can't figure out how to set the Login tool to point to the remote provider.

TIA!

 
Old February 4th, 2007, 05:38 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look here: http://weblogs.asp.net/scottgu/archi...25/423703.aspx

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old February 7th, 2007, 04:28 PM
Registered User
 
Join Date: Feb 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Imar. The answer (that the connection string must be named LocalSqlServer) was simple, but as far as I could discover is not documented. Your response was extremely helpful.

I had previously named my connection string RemoteSqlServer, which seemed reasonable. :)


 
Old February 7th, 2007, 04:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Indeed, very reasonable....

The thing is, the LocalSqlServer connection string comes preinstalled with .NET. So, by default, every site that uses provider features will end up this connection sting.

Scott's suggestion works good, but IMO, it's a bit weird. Having a LocalSqlServer that points to a RemoteSqlServer feels unnatural.

So, instead of redefining LocalSqlServer, you can redefine the providers instead. For example:
Code:
<membership>
  <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider"
       type="System.Web.Security.SqlMembershipProvider, System.Web, 
       Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        connectionStringName="BugBase" 
      enablePasswordRetrieval="false"
      enablePasswordReset="true"
      requiresQuestionAndAnswer="false"
      applicationName="/"
      requiresUniqueEmail="true"
      passwordFormat="Hashed"
      maxInvalidPasswordAttempts="5"
      passwordAttemptWindow="10"
      passwordStrengthRegularExpression=""
    />
  </providers>
</membership>
With this code in web.config, you tell ASP.NET to look at the connection defined in connectionStringName instead of the one on LocalSqlServer.

You can do the same with the other provider based features.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hosted Form of Component angelboy C# 2005 7 March 31st, 2008 02:36 PM
Database GUI – Admin & Dev tool for MySQL malbest MySQL 1 February 6th, 2008 07:49 AM
Hosted BeerHouse and sub directory gb012993 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 16th, 2008 01:48 AM
Events with IIS hosted remoting koraykazgan C# 1 May 1st, 2007 03:49 PM
Moving App to Hosted site dthoma128 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 13 December 19th, 2006 03:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.