.NET equivalent of Java Servlet Filters
Is there a .NET equivalent 开发者_JS百科to using Servlet Filters for request pre-processing in .NET?
You should create an HttpModule and handle the HttpApplication
events (Probably BeginRequest
).
ASP.NET MVC provides just such a filter API, along with a set of out-of-the-box filters for validation, authorization, and other common pre- or post-processing needs. Here is an introductory tutorial:
http://www.asp.net/mvc/tutorials/understanding-action-filters-cs
精彩评论