Contents tagged with ASP.NET

  • Logging Errors with ELMAH in ASP.NET MVC 3 – Part 5 – (JavaScript)

    Tags: ASP.NET, MVC, Logging, Error Handler, Elmah, javascript

    Now we need a way to track those pesky client side error messages. Tracking the server side errors is the easy part, but what about those browser errors that go unnoticed and unfixed?

    First, create the Server Side Handler

    To handle and log JavaScript errors, we'll first need to setup some server side code. The client (browser) will pass these errors to the server, which will hand them off to ELMAH for tracking. So let's start by creating a new Exception type for our JavaScript exceptions. This will allow us to differentiate the server errors from the JavaScript errors more easily. It doesn't need much so this should be fine...

    Read more...

  • Logging Errors with ELMAH in ASP.NET MVC 3 – Part 4 - (HandleErrorAttribute)

    Tags: ASP.NET, MVC, Logging, Error Handler, Elmah

    Creating a custom HandleErrorAttribute for ELMAH (Optional)

    Remember when we commented out that line from our Global.asax.cs in Part 1? Well, building our own HandleErrorAttribute will allow us to put it back or more importantly prevent the HandleErrorAttribute from overriding our ELMAH behavior. Currently the HandleError attribute will prevent any errors from bubbling up to ELMAH and we can't guarantee down the line, someone won't use a HandleError attribute like this...

    Read more...

  • Logging Errors with ELMAH in ASP.NET MVC 3 – Part 3 – (Filtering)

    Tags: ASP.NET, MVC, Logging, Error Handler, Elmah

    Filtering Unwanted Errors

    Ok, the reason I really like receiving an email for the every error message is because it will get annoying really fast. This results in me fixing the errors really fast. But there are just some errors that you just can't (or don't want to) "fix". If you noticed in Part 1, the error page contained some 404 errors for /favicon.ico. Errors like these will get annoying really quickly, and fortunately there's an easy way to filter them out. This chunk of code will filter out all 404 errors with a URL matching /favicon.ico.

    Read more...

  • Logging Errors with ELMAH in ASP.NET MVC 3 – Part 2 – (Notifications)

    Tags: Elmah, ASP.NET, MVC, Logging, Error Handler

    Setup Notifications for ELMAH Errors

    Now that ELMAH is setup, you need a way to be notified when an error occurs. Though you can just subscribe to your ELMAH RSS feed at /elmah.axd/rss, I prefer to receive an email notification as soon as an error happens. To do this simply merge the following changes into your web.config's <configuration> section.

    Read more...

  • Getting ASP.NET MVC 3 working on DiscountASP.net

    Tags: ASP.NET, DiscountASP.net, MVC

    Though this article should apply to any IIS7 shared-hosting platform, I can only confirm it works on DiscountASP.net.

    Getting Errors After Deploying your Application?

    After deploying your application, you might see the following error message...

    Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

    This is due to the MVC binaries not being installed in the GAC on the server. But do not fret, the GAC is only optional for MVC 3!

    Read more...