. Net implements URL rewriting and pseudo-static
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
After the download is complete, import the project. I have not made any changes to the project here, keep the original rewrite method, and then generate the. dll file directly in VS2005.
2. Use the dll file:
Add reference.
3. The page design is not described here. I will put a download package. If you are interested, please download it and check that the code 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> the mode to be searched </LookFor>
<SendTo> string used to replace the mode </SendTo>
</RewriterRule>
<RewriterRule>
<LookFor> the mode to be searched </LookFor>
<SendTo> string used to replace the mode </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 Applications' --> internet Information Service --> Find the directory you shared --> right-click Properties --> click 'configuration' --> under ing --> 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.