Permalink
Browse files

detect cassinidev as well as cassini

fix for #257. now uses process detection to determine if running in
cassini or a drop in replacement such as cassinidev.
  • Loading branch information...
1 parent a423b7d commit 48d14a98ebcd119250681fa544485b567c1cf1db @willholley willholley committed May 14, 2012
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/Cassette.Aspnet/CassetteHttpModule.cs
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.Linq;
+using System.Security;
using System.Text.RegularExpressions;
using System.Web;
@@ -65,11 +66,16 @@ void HandleHttpApplicationEvents(HttpApplication httpApplication)
static bool IsRunningInCassini()
{
- return AppDomain.CurrentDomain
- .GetAssemblies()
- .Any(
- a => a.FullName.StartsWith("WebDev.WebHost")
- );
+ try
+ {
+ // detects cassini or drop in replacement cassinidev (which does not have a managed assembly we can sniff)
+ return Process.GetCurrentProcess().ProcessName.StartsWith("WebDev.WebServer");
+ }
+ catch(SecurityException)
+ {
+ // assume if not in full trust then we're not using cassini
+ return false;
+ }
}
void RewriteFileRequests()

0 comments on commit 48d14a9

Please sign in to comment.