Previous Next

Thread: Security Exception for a managed module

Last post 05-16-2008 12:11 AM by CarlosAg. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 05-15-2008, 11:53 AM

    • ma_khan
    • Top 25 Contributor
    • Joined on 03-16-2008, 4:26 PM
    • Posts 161
    • ma_khan

    Security Exception for a managed module

    Hey,

     I have written a simple Http Module that would write certain IIS log entries into the event log.

    Very simple entries like Host address, Ip address and stuff like that.

    Added the module in IIS 7(rest all the settings are default) and when I run the website page it gives me a Security exception that it is not able to write into the system event logs due to no proper permissions.

    I tried the app with all the .Net trust levels but the same response. :)

    Anyways I got it working when I used an Admin account for my App Pool. Everything is working fine. But I thought it was the .Net trust levels that kicks in for http modules??

    What am I missing and is it possible to get it to work with medium trust with a non-admin account??

    I am using Windows Server 2008 Standard edition with Visual C# express edition.

     

     

    Regards,
    MA Khan
    http://www.iisworkstation.com

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
  • 05-15-2008, 12:01 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 872
    • anilr

    Re: Security Exception for a managed module

    It is not .net trust level - non-admins cannot write to system event log - use the application event log instead.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 05-15-2008, 1:04 PM In reply to

    • ma_khan
    • Top 25 Contributor
    • Joined on 03-16-2008, 4:26 PM
    • Posts 161
    • ma_khan

    Re: Security Exception for a managed module

    Oh my typo :)

    it is not the system event log it is the application event log that i meant... It is possible that we can have the module write into the application event log with the defult AppPool Settings itself??

    Regards,
    MA Khan
    http://www.iisworkstation.com

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
  • 05-16-2008, 12:11 AM In reply to

    • CarlosAg
    • Top 50 Contributor
    • Joined on 02-19-2003, 2:23 AM
    • Posts 61
    • CarlosAg

    Re: Security Exception for a managed module

    What really fails when writing to the Event Log is that you probably have not registered the Event Source which tries to write to the registry which you cannot do from an ASP.NET application.

    If you write a small "setup" program that registers the Event Source you should be able to write to the Application Event Log with no problems.

    http://support.microsoft.com/kb/329291

Page 1 of 1 (4 items)
Page view counter