elmah

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

假装没事ソ 提交于 2019-11-30 20:18:48
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? If you're using Roles you can add this to your web.config: <location path="~/elmah.axd"> <system.web> <authorization> <allow roles="Admin" /> <deny users="*" /> </authorization> </system.web> </location> If you're not

Elmah not working on IIS7 server

心不动则不痛 提交于 2019-11-30 20:14:32
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 could troubleshoot this? Thanks in advance. DEHAAS ELMAH is using a HttpModule to log errors. For IIS6,

Using property injection instead of constructor injection

徘徊边缘 提交于 2019-11-30 18:15:46
Long story short, I'm trying to use ELMAH with MVC 2 and Ninject, and I need to use parameterless constructors. I created an initial post about it here: Using a parameterless controller constructor with Ninject? I was advised to use property injection instead of constructor injection. So I moved from this: public class DepartmentsController : Controller { private IDepartmentsRepository departmentsRepository; public DepartmentsController(IDepartmentsRepository departmentsRepository) { this.departmentsRepository = departmentsRepository; } ... } to this: public class DepartmentsController :

Logging username with Elmah for WCF Webservices

佐手、 提交于 2019-11-30 14:48:33
We are using the approach described here to log our webservice errors with Elmah. And this actually works, but sadly the username beeing logged is empty. We did some debugging and found, that when logging the error in the ErrorHandler the HttpContext.Current.User has the correct User set. We also tried: HttpContext context = HttpContext.Current; ErrorLog.GetDefault(context).Log(new Error(pError, context)); and ErrorLog.GetDefault(null).Log(new Error(pError)); Without success. Any ideas on how we can make Elmah log the username? On a sidenote, when logging the error directly within the

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

妖精的绣舞 提交于 2019-11-30 11:55:39
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? JamesEggers 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 interface that's created through it's HTTP Module. I was tasked to explore this option for my company

Configuring custom authorization with ELMAH

纵然是瞬间 提交于 2019-11-30 10:11:13
How can I configure ELMAH to display only for certain people without default ASP.NET authorization roles manager? I (as well as many others, I think) use my own authorization logic and build my projects from zero without using provided templates. I want to log errors but it seems that it is impossible to configure ELMAH (somehow override functionality) to make it work with some other authorization or even to make it work only for particular IP addresses. Since I will have access to web.config I tried to change these values in order to NOT display elmah by default. <add key="elmah.mvc

ELMAH vs Enterprise Library Exception Handling Block

浪尽此生 提交于 2019-11-30 09:08:57
My team is currently in the process of building an ASP.NET MVC application, and we're trying to decide which of these frameworks to implement to deal with error handling and logging. What are the reasons for choosing one of these over the other? Personally, I've been using Enterprise Library for a number of our clients and I have yet to use ELMAH. Here's my thoughts on Ent Lib. It will take you a bit to get up to speed with Ent Lib - it's not a 5 second install and start using it thing. There's alot of configuration to do in the app.config/web.config file just to make it work. That said, once

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

蹲街弑〆低调 提交于 2019-11-30 08:32:16
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 used log4net together with elmah, is there anyway you can get them to share the same db table??

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

眉间皱痕 提交于 2019-11-30 07:48:21
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 old style HttpContext? SHODAN Try System.Web.HttpContext.Current . It should do the trick. Gets HTTP

How can I mock Elmah's ErrorSignal routine?

陌路散爱 提交于 2019-11-30 06:36:58
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! Matthew Manela Since the FromCurrentContext() method is a static method you can't simply mock the call to it. You