views:

227

answers:

3

What's the best way to have two websites (asp.net based) running on different domains but using the same database ?

Would it be a good idea to have the database on one of the domains and have the other one access it via a web service ?

+2  A: 

I would of thought that the best way would be to host the domains on the same server and then access the database locally.

GenericTypeTea
+4  A: 

I really don't think it makes too much difference. You should be able to just set the conneciton string and connect to the database from where ever you like. Ideally you would have your webservers in a DMZ, and your DB on a trusted network anyway, so in an ideal world with one website they would be on different networks...

Just set your connection strings for each site, and connect away.

Paul
Just to clarify, the websites would be hosted by two different hosting companies and so wouldn't be on the same servers. Would this method still work ? ie. one had the database and the other had to connect to it ?
cyberbobcat
Yes. It should do.
Paul
A: 

I can't think of a (common) scenario where you would be able to directly connect from one site but not the other.

In any instance where you would have to use a web service, I would think you would need the web service to be a 3rd asp.net application, not a part of one of the web sites.That being said, there are reasons to have your web sites access a database through a web service (decoupling the site from the data store, using a lot of javascript, etc.)

marr75