locked
editing my web.config does not work even after IISreset RRS feed

  • Question

  • User1868852945 posted

    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 screen.  

    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.

    Thanks.

    <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="adminPassword" value="friday" />
    </appSettings>

     

    Thursday, August 3, 2017 2:06 PM

Answers

  • User1771544211 posted

    Hi gunderj,

    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

    Best Regards,

    Jean

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 4, 2017 2:08 AM

All replies

  • User1970566204 posted

    hi,

    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 :        <%: ViewBag.myPassword %>

    Thursday, August 3, 2017 2:20 PM
  • User753101303 posted

    Hi,

    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?

    Thursday, August 3, 2017 4:26 PM
  • User1868852945 posted

    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. 

    Thursday, August 3, 2017 5:42 PM
  • User753101303 posted

    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?

    Thursday, August 3, 2017 6:12 PM
  • User1868852945 posted

    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.

    Thursday, August 3, 2017 6:42 PM
  • User1771544211 posted

    Hi gunderj,

    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

    Best Regards,

    Jean

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 4, 2017 2:08 AM