Implement urlrewriter Technology in ASP. net2.0

Source: Internet
Author: User
I have been paying attention to urlrewriter for a long time. I first came into contact with urlrewriter in my blog. Then I saw the corresponding applications on other blog websites. Urlrewriter A simple example is to set article. aspx? Articleid1_20's address is converted into a virtual address, such as articlew.htm or article/w.htm. this example reader articlew.htm or article/w.htm can direct it to the actual address article. aspx? ArticleID = 20. The advantage of this is that the search engine can easily search for this article. Article The content also helps users understand the webpage address to facilitate memory and security, hiding the real address. I have seen the introduction of urlrewriter in Microsoft msdn before, but the language is obscure and hard to understand, so I gave up my research on it later. Later, I also read some summary written by others and learned that I can reference it with a DLL component, so I don't have to write it myself. Program Implement urlrewriter. Today, I suddenly wanted to use it in the home bus, so I picked it up again and found it very easy to implement it with components. I have learned about two components: Microsoft's urlrewriter. dll and open-source writing by foreigners. It is designed to provide ASP. net2.0's urlrewritingnet. The method of use is online search, others write http://www.hzpal.com/Discuss/DotNet/459.aspx (in fact, is written by the people in the blog, but today the blog can not open ). Let me summarize. 1. set urlrewritingnet. urlrewriter. DLL copy to bin directory 2. in the web. config. copy urlrewritingnet. XSD file (I didn't do this step because others didn't copy the file, but it does not seem to affect it. If there is a problem, let's talk about it.) 4. define the URL rewriting rule (that is, the link in your Aspx file is changed to the address after rewriting, which is what I understand). It can be implemented right after all. Explanation:
< Add Name = "Rewrite" Virtualurl = "^ ~ /(. *)/Detail (. * pai.htm" Rewriteurlparameter = "Excludefromclientquerystring" Destinationurl = "~ /Default. aspx? Type = $1 & amp; id = $2" Ignorecase = "True"   /> (. *) Indicates the parameter, that is, the address format after rewriting. For example, detail (. *). aspx can convert detail1.aspx to a real address. $1 represents 1st parameters. Here, the parameters follow the regular expression, for example (. [0-9] *) to indicate numbers. In addition, you must add the same extension item HTM as the configuration on the ASPX page in IIS \ your site \ properties \ main directory \ Configuration \. Note: Do not select "check whether the file exists". Otherwise, the file cannot be found. The last step is to change the address output on the ASPX page to the corresponding rewrite address, for example, <a href = detail <% # databinder. eval (container, "dataitem. ID ") %>. htm> after completing the preceding steps, you can implement urlrewriter.
However, it is said that the DataGrid has been put, and there are pages. When you click to the next page, you will find that, fainted, and there was another problem. But I did not.
If you encounter it, you can refer to here: http://www.dowebs.net/forums/index.php? Showtopic = 345: Create your own htmlform.
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.