in the web.config file there is something like:
<configuration> <appSettings> <add key="ImagesFolder" value="\Images" /> </appSettings> </configuration>
then in your ASP.NET C # code you can use:
var ImagesFolder = ConfigurationManager.AppSettings["ImagesFolder"]; var files = Directory.GetFiles(Server.MapPath(ImagesFolder));
remember that you need to add a reference to the System.Configuration assembly or you cannot add a using statement and gain access to the ConfigurationManager .
this way there are no hard-coded values, and you can write down the value you want for this appsetting by editing the web.config file in the expanded folder on the web server.
Davide piras
source share