[Mono-list] Servlets in .Net/Mono?

Miguel de Icaza miguel at ximian.com
Thu Dec 14 22:03:19 EST 2006


Hello,

> Please pardon me if I missed the obvious in my Googling around, but I was 
> wondering if there is any sort of a framework under .Net/Mono like the Java 
> Servlet framework, and if so, if Mono includes a container. I have a strong 
> dislike for in-page markup scripting approaches like PHP, JSP and ASP.Net, 
> and so I was hoping to find something that leverages the excellent Mono 
> framework to do something similar to Servlets. Once again, I am sorry if the 
> answer is obvious and I missed it in my searching. Thanks for the help!

In ASP.NET you do that by implementing an IHttpHandler.

Put in a file called "file.ashx", something like this:

<%@ WebHandler Language="c#" class="ServletSharp" %>

class ServletSharp : IHttpHandler {

void IHttpHandler.ProcessRequest (HttpContext context)
{
	context.Response.ContentType = "text/html";
	context.Response.Write ("<html><body>Hello</body></html>");
}
}

Miguel.



More information about the Mono-list mailing list