HttpContext.Current.Request.PhysicalApplicationPath
配置文件中内容:
<configuration> <appSettings> <add key="connStr" value="Provider=Microsoft.Jet.OleDb.4.0;Data Source="/> <add key="DataPath" value="App_Data/dbNews.mdb"/> </appSettings>
从配置文件中读取完整链接字符串 :
string connStr = ConfigurationManager.AppSettings["connStr"].ToString() + HttpContext.Current.Request.PhysicalApplicationPath+ConfigurationManager.AppSettings["DataPath"].ToString();
Powered by: 博客园 Copyright © 2024 烈火123 Powered by .NET 9.0 on Kubernetes