c# - How do I set AppSettings in an ASPX project's Configuration manager -
this aspx/cs project visual studio 2010. configuration manager question.
i debugging (sort of) code being used on server. there piece of code plays url in live version should not used in debug/localhost version.
protected void page_load(object sender, eventargs e) { if (configurationmanager.appsettings["istesting"] == "false" && request.url.tostring().contains("http:")) { response.redirect(request.url.tostring().replace("http:", "https:")); } loadmastertemplate(); }
this piece of code lands on "response.redirect...." line when should not because "istesting" app setting should set true in configurationmanager . how set that?
inside <configuration>
element in app/web.config file, there should (or should create) <appsettings></appsettings>
tag, , individual settings bit this:
<appsettings> <add key="newkey0" value="something1" /> <add key="newkey1" value="something2" /> </appsettings>
Comments
Post a Comment