summaryrefslogtreecommitdiff
path: root/slips/src/app/Marina/Web/UnhandledExceptionsHttpModule.cs
blob: d2267f2601f33416b82ace6aa0b6f6ba5bc45105 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System;
using System.Web;
using Marina.Infrastructure.Logging.Interfaces;
using Marina.Web.Views;

namespace Marina.Web {
	public class UnhandledExceptionsHttpModule : IHttpModule {
		public void Init( HttpApplication context ) {
			context.Error += delegate {
			                 	foreach ( Exception exception in context.Context.AllErrors ) {
			                 		Log.For( this ).CriticalError( exception.ToString( ) );
			                 	}
			                 	Redirect.To( WebViews.Login );
			                 };
		}

		public void Dispose() {}
	}
}