c# - Best way to do a setting in ASP.net -
with settings, i've had const variable in file somewhere. possible create new config file settings website? ie:
const imageprefixpath = "http://img.domain.com/"
is sort of thing want store , use on web code
use appsettings in web.config instead:
<configuration> <appsettings> <add key="imageprefixpath" value="http://img.domain.com/" /> </appsettings> </configuration>
then access in code access appsettings variables using openwebconfiguration
system.configuration.configuration config = system.web.configuration.webconfigurationmanager.openwebconfiguration(null); string imagepath = config.appsettings.settings["imageprefixpath"] + "myimage.jpg";
Comments
Post a Comment