. , , asp.net:
ASP.net:
- , , . , , . ASP.NET - , . ASP.NET API WebForms, - ASMX, WCF, ASP.NET Web API ASP.NET MVC HTTP . (, IHttpModule) (, IHttpHandler). , , . , . , , , . ASP.net :
public class SimpleHttpModule : IHttpModule
{
public SimpleHttpModule(){}
public String ModuleName
{
get { return "SimpleHttpModule"; }
}
public void Init(HttpApplication application)
{
application.BeginRequest +=
(new EventHandler(this.Application_BeginRequest));
application.EndRequest +=
(new EventHandler(this.Application_EndRequest));
}
private void Application_BeginRequest(Object source,
EventArgs e)
{
HttpApplication application = (HttpApplication)source;
HttpContext context = application.Context;
context.Response.Write(SomeHtmlString);
}
private void Application_EndRequest(Object source, EventArgs e)
{
HttpApplication application = (HttpApplication)source;
HttpContext context = application.Context;
context.Response.Write(SomeHtmlString);
}
public void Dispose(){}
}
<configuration>
<system.web>
<httpModules>
<add name=" SimpleHttpModule " type=" SimpleHttpModule "/>
</httpModules>
</system.web>
</configuration>
ASP.NET HTTP , . HTTP- :
public class SimpleHttpHandler: IHttpHandler
{
public void ProcessRequest(System.Web.HttpContext context){
context.Response.Write("The page request ->" +
context.Request.RawUrl.ToString());
}
public bool IsReusable
{
get{ return true; }
}
}
. , ASP.NET .smp, SimpleHttpHandler:
<system.web>
<httpHandlers>
<add verb="*" path="*.smp" type="SimpleHttpHandler"/>
</httpHandlers>
</system.web>
-, Java Servlets ( ), IIS ISAPI.