Yesterday, I posted an article about using ISAPI filter to implement URL pseudo-static Article I did it according to the content in the article, but it does not appear that this method does not use Microsoft urlrewriter. the DLL method is good. At least I personally think it took me a night to finally find out how to use this DLL file to implement static on the Asp.net page, which is actually very simple.
1. Obtain Mircosoft urlrewriter. dll:
Get Mircosoft urlrewriter. dll available to http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx? MFR = true
Here, select [download the source code of this article]. After the download is complete, import the project. I have not made any changes to this project, and keep the original rewrite method, then it is generated directly in vs2005. DLL file.
2. Use the DLL file:
Add reference.
3. The page design is not described here. I will release a download package. If you are interested, please download it, Code Write is messy.
4. Web. config Configuration
This is critical, and it is also the key to static-based success. <? XML version = "1.0" ?>
< Configuration >
< Configsections >
< Section Name = "Rewriterconfig" Type = "Urlrewriter. config. rewriterconfigserializersectionhandler, urlrewriter" />
</ Configsections >
< Rewriterconfig >
< Rules >
< Rewriterrule >
< Lookfor > ~ /Web/New/type/(. [0-9] *) \. html </ Lookfor >
< Sendto > ~ /Web/New. aspx? Id = $1 </ Sendto >
</ Rewriterrule >
< Rewriterrule >
< Lookfor > ~ /Web/index.html </ Lookfor >
< Sendto > ~ /Web/index. aspx </ Sendto >
</ Rewriterrule >
</ Rules >
</ Rewriterconfig >
< System. Web >
< Httphandlers >
< Add Verb = "*" Path = "*. Aspx" Type = "Urlrewriter. rewriterfactoryhandler, urlrewriter" />
< Add Verb = "*" Path = "*. Html" Type = "Urlrewriter. rewriterfactoryhandler, urlrewriter" />
</ Httphandlers >
< Compilation Debug = "True" /> </ System. Web >
</ Configuration >
Here is a brief introduction: < Rewriterconfig >
< Rules >
< Rewriterrule >
< Lookfor > Mode to be searched </ Lookfor >
< Sendto > String to be used to replace the pattern </ Sendto >
</ Rewriterrule >
< Rewriterrule >
< Lookfor > Mode to be searched </ Lookfor >
< Sendto > String to be used to replace the pattern </ Sendto >
</ Rewriterrule >
</ Rules >
</ Rewriterconfig >
Httphandlers is mainly used in combination with IIS to redefine and process requests. This is also critical. If there is no reasonable httphandlers, the access will certainly fail.
You can search for regular expressions in Baidu: "common regular expressions", there will be many.
5. Configure the iis .html File
Right-click my computer> Manage> Expand services and applicationsProgram'--> Internet Information Service --> Find the shared directory --> right-click Properties --> click 'configuration' --> map to the following --> Find. aspx executable file path copy path --> paste path --> the extension is ". html "--> then remove the check object check box. If the" OK "button becomes invalid, you can use the keyboard event editing path to solve the problem.
Instance download: http://files.cnblogs.com/zhangyi85/StaticWeb.rar