Seo-Global. asax in ASP. NET and rewritepath () in httpmodule

Source: Internet
Author: User

This series of directories

 

Because I found a lot of this information on the Internet.ArticleAnd the importance of Seo In urlrewrite is gradually decreasing, so this section is easier to write. The following are the key points:

1. urlrewrite, as its name implies, is only a URL rewriting operation. do not consider it as a scheme? Author = Jack & id = 2467. Therefore, some people have called this technology "pseudo-static" in the past. Of course, since there is a "pseudo" technology, it is true, that is, I/O operations, generate an HTML file based on user input, database query, and so on. This technology is no longer discussed in this series (and I personally think it is of little value ).

2. Convert www.freeflying.com/jack/articles-2467.html to www.freeflying.com/articles.aspx? Author = Jack & id = 2467, certainly cannot be completed in the page events we are used. Because without conversion, we cannot reach the limit. Therefore, the conversion will be performed in the "ApplicationProgramCompleted in lifecycle.

There are two specific implementation methods: Global. asax and httpmodule; but they all adopt the same method: rewritepath ().

For global. asax or httpmodule, many people think that httpmodule is more efficient, but I cannot understand it. According to msdn, "If we create global. asax file, which will be compiled into an httpapplication derived class, And the httpapplicant derived class replaces the default httpapplication instance to maintain the application. When an httpapplication instance is created, all the httpmodules registered in Web. config are also created. Then, the init () method of httpapplication is called ." "The httpapplication instance maintains a pipeline to verify request requests and cache requests in sequence." The most common events are beginrequest events (in urlrewrite, this method is called ), procesrequest () method (the method that must be implemented in httphandler ). Therefore, I think that httpapplication (including the Global. asax file) "contains" containers "of application events, httpmodule, and httphandler ". RegardlessCodeWritten in global. asax or httpmodule, the performance is the same.
3. As shown in the Code, if there is only one or several conversions, we can use expressions like If. What if there are thousands of conversions? As you can imagine, ID is the auto-increment field of a table in the database. Is there an automatic processing mechanism that allows us to intelligently convert URLs? Yes, it is a well-known regular expression. We will explain in the next special section.

Finally, I found some good reference links:

Is urlrewrite necessary? Google official explanation

"Url routing" in ASP. net4.0 is said to be able to implement the same functions as URL rewrite.

The urlrewrite implementation mechanism of Lao Zhao's blog in the garden

Or Lao Zhao, probably a blog written after being mad by seoer

Related Article

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.