asp.net implements URL rewriting, pseudo static

Source: Internet
Author: User

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.

 
  1. <?xml version= "1.0"?>
  2. <configuration>
  3. <configSections>
  4. <section name= "Rewriterconfig" type= "URLRewriter.Config.RewriterConfigSerializerSectionHandler, Urlrewriter"/ >
  5. </configSections>
  6. <RewriterConfig>
  7. <Rules>
  8. <RewriterRule>
  9. <lookfor>~/web/new/type/(. [ 0-9]*)/.html</lookfor>
  10. <SendTo>~/web/new.aspx?id=$1</SendTo>
  11. </RewriterRule>
  12. <RewriterRule>
  13. <LookFor>~/web/index.html</LookFor>
  14. <SendTo>~/web/index.aspx</SendTo>
  15. </RewriterRule>
  16. </Rules>
  17. </RewriterConfig>
  18. <system.web>
  19. <add verb= "*" path= "*.aspx" type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>
  20. <add verb= "*" path= "*.html" type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>
  21. <compilation debug= "true"/></system.web>
  22. </configuration>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.