如何从子域连接到base? SQLiteConnector,connectionString

时间:2015-03-28 18:43:27

标签: c# asp.net sqlite web-config

我的网站c#asp.net和SQLite。在主要的圆顶www。我的网站。 com在web.config中工作正常......

 <connectionStrings>
        <add name="SQLiteConnector" connectionString="Data Source=|DataDirectory|MyBase.db3;" 
providerName="System.Data.SQLite"/>
          </connectionStrings>

MyBase.db3位于App_Data文件夹中。 现在我在域www中有网站。 NewSubdomain。 MySite .com 并且不知道如何在主要的地方www.MySite.com建立连接基地 我必须在web.config中放置什么?我还需要更多东西或者连接吗? HELP !!!

1 个答案:

答案 0 :(得分:0)

由于web.config文件对于所有站点都是通用的,因此您可以为每个子域添加这样的多个连接字符串:

<connectionStrings>
        <add connectionString="" name="subdomain1"/>
        <add connectionString="" name="subdomain2"/>
</connectionStrings>

然后您可以使用

检查当前网址
HttpContext.Current.Request.Url.AbsoluteUri