Relative path reference in WebConfig.ConnectionString

后端 未结 5 1338
误落风尘
误落风尘 2020-12-15 23:12

Is it possible to specify a relative path reference in connectionstring, attachDbFileName property in a web.config?

For example, In my database is located in the App

5条回答
  •  醉话见心
    2020-12-15 23:21

    Web.config

      
        
      
    

    Path.cs

    string filePath = AppDomain.CurrentDomain.BaseDirectory + (ConfigurationManager.AppSettings["FilePath"]);
    

    Works for me..!!

提交回复
热议问题