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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -