0

I installed ELMAH.MVC nuget package and it's logging my ASP.NET MVC errors. However when I go to http://www.example.com/en-us/elmah the page is not styled and the below error is shown:

A public action method 'stylesheet' was not found on controller 'Elmah.Mvc.ElmahController'.

I have the following Routes:

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("content/{*pathInfo}");
        routes.IgnoreRoute("favicon.ico");

        routes.MapRoute(
        name: "users",
        url: "{culture}/users/{userUrl}",
        defaults: new
        {
            controller = "AccountProfile",
            action = "Index",
            culture = ""
        }
    );

        routes.MapRoute(
                        name: "SpecificCulture",
                        url: "{culture}/{controller}/{action}/{id}",
                        defaults: new
                        {
                            controller = "Home",
                            action = "Index",
                            id = UrlParameter.Optional,
                            culture = ""
                        }
                    );
    }

My web.config appSettings:

<appSettings>
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="BaseAddress" value="http://localhost:3453/" />
    <add key="MailActive" value="true" />
    <add key="aspnet:UseHostHeaderForRequestUrl" value="true" />    
    <add key="elmah.mvc.disableHandler" value="false" />
    <add key="elmah.mvc.disableHandleErrorFilter" value="false" />
    <add key="elmah.mvc.requiresAuthentication" value="true" />
    <add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
    <add key="elmah.mvc.allowedRoles" value="Administrator" />
    <add key="elmah.mvc.allowedUsers" value="*" />
    <add key="elmah.mvc.route" value="elmah" />  
</appSettings>

I believe the issue is on my routes, but sincerely I have no clue what to do about it.

Any help would be great

EDIT :

As sugested by Steve Newton I added the following route:

    routes.MapRoute(
    name: "elmah",
    url: "{controller}/elmah",
    defaults: new
        {
            controller = "elmah",
            action = "Index",
        }
    );

Thanks

  • possible duplicate of [ELMAH: Elmah pages not styled making them difficult to read](http://stackoverflow.com/questions/14875750/elmah-elmah-pages-not-styled-making-them-difficult-to-read) – Sven Grosen Jul 08 '14 at 20:52
  • The solution suggested by the other question don't solve my problem, so I guess it's a different root cause. – Christopher Bailey Jul 08 '14 at 20:57
  • Per that other question, you tried modifying the config for Elmah? – Sven Grosen Jul 08 '14 at 21:02
  • I have no idea what to put on the ``elmah.mvc.route``. – Christopher Bailey Jul 08 '14 at 21:04
  • Then how do you know that answer won't help you? By the way, I'd first try ``. That's obviously not a pleasant thing if you have multiple cultures, but it would at least prove that that indeed does fix it. – Sven Grosen Jul 08 '14 at 21:06
  • Sorry, I think I didn't express myself very clearly. I tried 2 or 3 different values but I got the same error. I also changed the ```` to ``true`` – Christopher Bailey Jul 08 '14 at 21:11

1 Answers1

0

This looks like a routing issue as described in the answer provided. Why not leave the route config for Elmah as is (the key) and create a new route which allows example.com/elmah? Elmah will not vary by culture and is a clean solution.

Steve Newton
  • 1,046
  • 1
  • 11
  • 28