How to detect whether IIS logging for particular site has been disabled or not in c#? [Answered]RSS

1 reply

Last post Dec 01, 2014 07:53 AM by lextm

  • How to detect whether IIS logging for particular site has been disabled or not in c#?

    Dec 01, 2014 06:31 AM|mahe001|LINK

    I am i am reading the applociationHost.config of IIS application in c# application , when i disable to logging for particulate website it will add the another node in config like below 

    <location path="Testing">
            <system.webServer>
                <httpLogging dontLog="true" />
            </system.webServer>
    </location>

    but i can not able to read this properties in c# . My C# code sample is below 

      using (ServerManager serverManager = new ServerManager())
      {
    
          Configuration config = serverManager.GetApplicationHostConfiguration();
                    
      }

    but config varaible only has the below three section group . from this section group i am not able to read the <location> node element

    system.webServer

    system.ftpServer

    system.applicationHost

    How can i detect the whether logging has been disabled or not for particular website from config file in c# application ?

    Thanks,

  • Re: How to detect whether IIS logging for particular site has been disabled or not in c#?

    Dec 01, 2014 07:53 AM|lextm|LINK

    http://msdn.microsoft.com/en-us/library/aa346850(v=vs.90).aspx

    There is a overloading function that takes the location tag.

    Lex Li
    IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.