Search code examples
asp.net-mvcasp.net-mvc-5elmahelmah.mvc

Custom authentication for Elmah in .net mvc


I have a mvc project but I use a custom membership provider which I cannot integrate with Elmah.

What I want is a way for me to make sure only admins can reach mydomain.com/Elmah

So either if I can get Elmah to check with my membership provider (which has nothing to do with any microsoft membership) or more likely if I can setup in web.config that that particular path requires separate authentication of some sort.

I am fine with having a separate user for accessing Elmah


Solution

  • In the web.config, in <appSettings> include this

    <add key="elmah.mvc.requiresAuthentication" value="true" />

    and in the <elmah> section include this

    <security allowRemoteAccess="yes" />

    now if you access mydomain.com/Elmah you get a pop up to enter your credentials. You can use the windows username/password of the machine on which you hosted the website.