Asp.Net applications

The following sample serves as a starting point for hosting Asp.Net applications with Minnow - this page is far from complete however, and it will probably be necessary to add many more handler mappings for most Asp.Net applications.

WebServer myServer = new WebServer();
myServer.LocalRoot = @"c:\MinnowRoot";
myServer.Prefixes.Add("http://+:80/Temporary_Listen_Addresses/");
myServer.RootUrl = "/Temporary_Listen_Addresses/";

AspNetHandler aspHandler = new AspNetHandler();
myServer.HandlerMappings.Add(new HandlerMapping("*.aspx", LocalMappingState.None, aspHandler));

StaticHandler staticHandler = new StaticHandler();
myServer.HandlerMappings.Add(new HandlerMapping("*.css", staticHandler));
myServer.HandlerMappings.Add(new HandlerMapping("*.js", staticHandler));
myServer.HandlerMappings.Add(new HandlerMapping("*.gif", staticHandler));
myServer.HandlerMappings.Add(new HandlerMapping("*.ico", staticHandler));
myServer.HandlerMappings.Add(new HandlerMapping("*.png", staticHandler));
myServer.HandlerMappings.Add(new HandlerMapping("*.html", staticHandler));

DirectoryHandler directoryHandler = new DirectoryHandler();
myServer.HandlerMappings.Add(new HandlerMapping("*", LocalMappingState.Folder, directoryHandler));

Last edited Aug 3, 2010 at 12:07 PM by Kragen2uk, version 2

Comments

No comments yet.