elmah

Error pages not found, throwing ELMAH error with Custom Error Pages

徘徊边缘 提交于 2019-11-30 05:08:33
I've made some modifications to Global.asax so that I can show custom error pages (403, 404, and 500) Here's the code: public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } protected void Application_Error(object sender, EventArgs e) { if (Context.IsCustomErrorEnabled) { ShowCustomErrorPage(Server

How to provide only Access for ELMAH.axd for Administrator login in web

▼魔方 西西 提交于 2019-11-30 04:23:28
问题 I have created application and implemented ELMAH logging. In my site there are three types of users. Admin : can everything (rights to view elamh.axd) User : can have own rights (can't view elamh.axd) Guest : only view (can't view elamh.axd) The above user will be stored in Database. Probelm:- Now how could i manage protection level for User and Guest to view ELMAH.axd log file? 回答1: If you're using Roles you can add this to your web.config: <location path="~/elmah.axd"> <system.web>

Elmah not working on IIS7 server

不羁岁月 提交于 2019-11-30 04:12:40
问题 I have Elmah running on my MVC 3 site, and have everything working on my local development machine. However, now that I've moved my site to my production server, Elmah is not working. I am using the same SQL account (and connection string) on my live server as I'm using on my local machine. The EF4 connection (same as Elmah) works just fine. I don't see anything in the Even Logs or in SQL Profiler. I don't see any errors in the SQL logs either. Any ideas on what could be happening, or how I

Is there any way to programmatically set the application name in Elmah?

为君一笑 提交于 2019-11-29 17:26:50
问题 I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App_Debug' in the Application field in the Elmah_Error table. Does anyone have any experience with this? Or is there another way to do it? 回答1: By default, Elmah uses the AppPool's application GUID as the default application name. It uses this as the key to identify the errors in the Elmah_Error table when you look at the web

Using log4net and where to implement it and using with elmah?

我怕爱的太早我们不能终老 提交于 2019-11-29 11:55:46
问题 does anyone have experience with log4net, i have been looking at elmah which is great. But i wanted a little bit more control i.e. to use logging not only in asp.net but also in wpf. Anway i decided to take a look at log4net. I have 2 clients, (wpf and asp.net) that both share business logic. Should i be raising events in business logic and in the client also ?? I presume the business logic will use the app.config / web.config (business logic is in another layer - a class project) Has anybody

How can you get the “real” HttpContext within an ASP.NET MVC application?

廉价感情. 提交于 2019-11-29 10:32:12
问题 Unfortunately, I need to do this. I'm using ELMAH for my error log. Before I route to my error.aspx view, I have to grab the default ELMAH error log so I can log the exception. You used to be able to use Elmah.ErrorLog.Default However, this is now marked as obsolete. The compiler directs me to use the method Elmah.ErrorLog.GetDefault(HttpContext context) MVC's context is of type HttpContextBase, which enables us to mock it (YAY!). How can we deal with MVC-unaware libraries that require the

How can I mock Elmah's ErrorSignal routine?

我是研究僧i 提交于 2019-11-29 06:17:41
问题 We're using ELMAH for handling errors in our ASP.Net MVC c# application and in our caught exceptions, we're doing something like this: ErrorSignal.FromCurrentContext().Raise(exception); but when I try to unit test the caught exceptions, I get this message: System.ArgumentNullException: Value cannot be null. Parameter name: context How can I mock the FromCurrentContext() call? Is there something else I should be doing instead? FYI... We're currently using Moq and RhinoMocks. Thanks! 回答1: Since

Problem passing ELMAH log id to Custom Error page in ASP.NET

一个人想着一个人 提交于 2019-11-29 04:38:51
I am using ELMAH to log unhandled exceptions in an ASP.NET Webforms application. Logging is working fine. I want to pass the ELMAH error log id to a custom error page that will give the user the ability to email an administrator about the error. I have followed the advice from this answer . Here is my global.asax code: void ErrorLog_Logged(object sender, ErrorLoggedEventArgs args) { Session[StateKeys.ElmahLogId] = args.Entry.Id; // this doesn't work either: // HttpContext.Current.Items[StateKeys.ElmahLogId] = args.Entry.Id; } But, on the Custom error page, the session variable reference and

“Resource not found” error while accessing elmah.axd in ASP.NET MVC project

瘦欲@ 提交于 2019-11-29 03:54:21
My ASP.NET MVC application is within a folder called Stuff within IIS 6.0 webroot folder. So I access my pages as http://localhost/Stuff/Posts . I had EMLAH working while I was using the in-built webserver of Visual Studio. Now when I access http://localhost/Stuff/elmah.axd , I get resource not found error. Can anyone point my mistake here! Here is config file entry, <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/> //Handler <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/> <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> <add name=

Error pages not found, throwing ELMAH error with Custom Error Pages

柔情痞子 提交于 2019-11-29 02:54:16
问题 I've made some modifications to Global.asax so that I can show custom error pages (403, 404, and 500) Here's the code: public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } protected void Application