Last post Aug 04, 2017 02:08 AM by Jean Sun
Aug 03, 2017 02:06 PM|gunderj|LINK
I have a password in my web.config as shown below. After publishing the MVC web application to my local IIS, I manually edit the password value, then when I run the app, the new value is not recognized. ASP.net documentation says the app domain will automatically
bounce after change to web.config which is not happening, so I tried both IISreset and bouncing the web site in IIS but still the new password is not recognized. Also I look in IIS manager tool and I do see the new pqassword value in the application settings
How do I get the new password value to be recognized after changing it? I do want to change the password in this way though probably not the best way to go about it.
<add key="webpages:Version" value="22.214.171.124" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="adminPassword" value="friday" />
Aug 03, 2017 02:20 PM|asyed4u|LINK
for testing purpose , may be try as below
1) add this in your (home or default) "controller/action" method
ViewBag.myPassword = WebConfigurationManager.AppSettings["adminPassword"]
2) utilize this viewbag.mypassword in (corresponding) VIEW
if Razor : @ViewBag.myPassword
if aspx : <%:
Aug 03, 2017 04:26 PM|PatriceSc|LINK
And it is used for ? Could it be that you cache this value somewhere ? If you have some kind of connection error could it be caused by something else than an outdated password?
Aug 03, 2017 05:42 PM|gunderj|LINK
Controller is passing everything fine - when I test it in visual studio 2013 it works fine. There is no caching going on either as I hit f5 on every attempt.
Aug 03, 2017 06:12 PM|PatriceSc|LINK
I meant rather not calling WebConfigurationManager.AppSettings["adminPassword"] everytime but "caching" that server side in a db or whatever...
If you still have an old value once resttarted are you sure to update the correct web.config file ? Ah, also you have a single web server?
Aug 03, 2017 06:42 PM|gunderj|LINK
Here is my Controller...
ViewBag.adminPassword = ConfigurationManager.AppSettings["adminPassword"];
This test that is failing is my local machine IIS. I cannot have this data in a db.
What does ASP.net documentation mean, "when web.config is changed the app domain is automatically restarted? Must be the same as bouncing the web site, no? I do this manually to no avail, also tried IISreset, still no avail.
Any ideas? Thanks.
Aug 04, 2017 02:08 AM|Jean Sun|LINK
when web.config is changed the app domain is automatically restarted?
This means that the IIS Application will restart if you modify the web.config file of this application.
Perhaps this issue is caused by asp.net cache, please go to the following directory and delete every folder in there.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files