elmah.axd: 403 - Forbidden: Access is denied.

Topics: ASP.NET 2.0
Mar 19, 2011 at 3:10 AM
Edited Oct 24, 2011 at 8:15 PM

Hello All,

Did a clean instation of elmah again locally everything works fine just when I put it up on a live server

it does not work.

http://www.kbdavis07.bloggersonline.com/elmah.axd

Could someone help me?

What would cause an .axd file to be denied on a server?

 

<fieldset>

403 - Forbidden: Access is denied.

You do not have permission to view this directory or page using the credentials that you supplied.

Java Blog
Coordinator
Mar 19, 2011 at 11:17 PM

In your web.config file, there is an <elmah> section.  If it's not already there (allowRemoteAccess), add the following and make sure the value is set to 1.

<elmah>
	<security allowRemoteAccess="1"/>
	.............
</elmah>

But this will allow anyone to see the log.  So you might want to modify the Handler in the web.config file .... either by changing the path and or name (elmah.axd) to something very obscure.

Coordinator
Mar 19, 2011 at 11:34 PM

Sorry, I deleted your post because I think it contained some markup that was causing the Reply functionality to not work in CodePlex.

Anyways,  you put <security allowRemoteAccess="1"/> in the wrong part of the web.config file.

It should be inside the <elmah> tag (as shown in my earlier message).  And if one already exists there (which may be the case), then it may be that you just need to change the value from "0" to "1".

Mar 19, 2011 at 11:46 PM

Thanks alot!!!!

 

This was missing from the Nuget web.config  file:

 

<elmah> 

        <security allowRemoteAccess="1" />

        <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/app_data/elmah" />

    </elmah>

Mar 19, 2011 at 11:53 PM

Now have it only avaiable through the admin section and have to login to view it .

 

<add name="Elmah" verb="POST,GET,HEAD" path="/admin/elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />

Coordinator
Mar 20, 2011 at 12:16 AM

That's good to hear it's working.  I haven't tried Elmah NuGet ... it's possible it doesn't add the <Elmah> section in there.   The <errorLog> you added tells it to store the data in the App_Data\elmah folder, I believe.  Probably before you added that, the data was being stored in-memory, which I know Elmah has as an option if you don't specify a data store (app_data, DB, email, etc).  When the errors are stored in-memory, and the blog re-starts, all the data is gone.  So probably it will now persist in the App_Data\elmah directory.

Mar 20, 2011 at 12:52 AM

yep its being stored in the app_data now.  Thanks for your help!

Apr 11, 2013 at 2:35 PM
Update on installing Elmah on BE 2.7 with Nuget

Here is the web.config file to get it to work:

This is at the very bottom of the web.config file around line 250

Items in bold is the things that needs to be changed.

<elmah>
<!--
    See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for 
    more information on remote access and securing ELMAH.
-->
<security allowRemoteAccess=__"false__" />
</elmah>
<location path="admin" inheritInChildApplications="false">
<system.web>
  <httpHandlers>
    <add verb="POST,GET,HEAD" path="__/admin/__elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
  </httpHandlers>


  <authorization>
    __<allow roles="Administrators" />__
    <deny users="*" />  
  </authorization>

</system.web>
<system.webServer>
  <handlers>
    <add name="ELMAH" verb="POST,GET,HEAD" path="__/admin/__elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
  </handlers>
</system.webServer>
</location>



To make it easier to access from with in the admin panel edit this file:

Web.sitemap

Its in the root directory

add this line to the very bottom of the list of links:


<siteMapNode url="~/admin/elmah.axd" title="Elmah" rights="AccessAdminSettingsPages" description="" />


Now you can access Elmah from within the Admin panel.