Click here to Skip to main content
15,882,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In web.config:

<connectionstrings>
<add name="ApplicationServices"
="" connectionstring="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|<b>DataDirectory</b>|\aspnetdb.mdf;User Instance=true" providername="System.Data.SqlClient">



** |DataDirectory| I need to provide the same '.mdf' for two seperate web applications. How can I achieve this?

Thanks
SB
Posted

If you use a connection string that connects to a database instance, instead of to a physical file, there should be no issue. Otherwise, I suspect you can only do it if one site is in a subdomain of another, or if you can set up file access so that a full path can be used ( although I doubt this is possible, a web app does not have access above it's root, I think you'd need to make your DB file visible to the world on a URL to do that ).
 
Share this answer
 
Thanks. How can I connect to the same sqlexpress default db using connection string or I'll have to make use of custom providers?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900