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();