One, get Mircosoft URLRewriter.dll:
Get Mircosoft URLRewriter.dll can go to http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx?mfr=true
After downloading, import the project, I do not have any changes to the project, retained the original rewrite way, and then directly in the VS2005 generated. dll file.
Second, use the DLL file:
Add a reference and fix it.
Third, the design of the page, here is not to repeat, I will put a download package, interested friends download to see it, the code to write more chaotic.
Iv. configuration of the web.config
This is critical and is the key to the success of static.
- <?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>
- <add verb= "*" path= "*.aspx" type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>
- <add verb= "*" path= "*.html" type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>
- <compilation debug= "true"/></system.web>
- </configuration>