The key value defined in The <etettings> element in Web. config can be used by the aspz file in all subfolders to modify data of multiple aspx files.
Take database connection as an example:
1,
In web. config
...
</System. Web>
<Deleetask>
<Add key = "nwind"
Value = "Server = (local) \ netsdk; database = northwind; Integrated Security = true;"/>
</Appsettings>
</Configuration>
Reference it in the aspx file:
String strconn = configurationsettings. receivettings ["nwind"];
2,
You can use the following methods to obtain the physical path of the database in the real directory of the remote host. Assume that the domain name address for uploading a remote space is as follows:
Http://www.pconline.com.cn/dkblog
3,
The relative path of server. mappath is used for Asp.net programming.
Think of a simple solution:
In web. config
<Deleetask>
<Add key = "accpath" value = "provider = Microsoft. Jet. oledb.4.0; Data Source ="/>
<Add key = "accname" value = "account. mdb"/>
</Appsettings>
In aspx
String strpath = configurationsettings. receivettings ["accpath"];
String strname = configurationsettings. receivettings ["accname"];
String strconn = strpath + server. mappath (strname );