ASP.NET URL Rewriting

Key Words: IIS(ISAPI extension ISAPI Filter) ASP.NET engine  Authenticate Authorize
ISAPI extension(such as asp.dll ISAPI aspnet_isapi.dll ISAPI )
Why do we need URL Rewriting
1.Are short.
2.Are easy to type.
3.Visualize the site structure.
4."Hackable," allowing the user to navigate through the site by hacking off parts of the URL.
5.handle website restructuring that would otherwise result in numerous broken links and outdated bookmarks.

how incoming requests are handled by Microsoft® Internet Information Services (IIS)(two ways:or)
1.Requests can be handled natively by IIS—as are HTML pages, images, and other static content
2.route the request to an ISAPI extension
e.g,For ASP.NET pages, IIS routes the message to the aspnet_isapi.dll ISAPI extension. The aspnet_isapi.dll ISAPI extension then hands off processing to the managed ASP.NET worker process, which processes the request, returning the ASP.NET Web page's rendered HTML.

IIS's Work:
1.Mapping the incoming Web request's file extension to the appropriate ISAPI extension
2.IIS attempts to authenticate the user making the request and determine if the authenticated user has authorization to access the requested file
3.During the lifetime of handling a request, IIS passes through several states. At each state, IIS raises an event that can be programmatically handled using ISAPI filters.

Both ISAPI filters and ASP.NET Engine  can be used to perform URL rewriting

What Happens When a Request Enters the ASP.NET Engine
Key Words: Event Delegate hangdler (just like IIS)
ASP.NET engine:
1.Raises events as it processes a request
2.Allows an arbitrary number of HTTP modules handle the events that are raised, akin to IIS's ISAPI filters.
3.Delegates rendering the requested resource to an HTTP handler, which is akin to IIS's ISAPI extensions.

Traditional IIS process flow:
1. During the lifetime of a request the IIS fires events signaling its change from one state of processing to another.
2.ISAPI filters can be created to respond to the events raised by IIS
3.an incoming request is eventually directed to an ISAPI extension, whose job it is to return the data for the particular request.

Referrences:http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx?mfr=true

posted @ 2006-06-03 23:12  晓岚  阅读(271)  评论(0编辑  收藏  举报