Convert aspx to HTML (pseudo static)

Source: Internet
Author: User

To improve website access speed and search engine indexing, sometimes we need to convert dynamic aspx to static html. This conversion can be divided into two types: pseudo static and real static! These two methods have their own advantages and disadvantages. Let's skip this one today and explain how pseudo-static operations are completed.

First, we must haveMircosoft urlrewriter. dll will be downloaded from the Internet if it does not exist, and then they will be taken to the bin of the project.

       Second, it is related to configuration in Web. config, which is also the most important

<? XMLVersion = "1.0"?>
<Configuration>
  <Configsections>
    <SectionName = "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>

The blue Department is very important. You can add and modify it as needed;

Such as product_list.aspx? PID = 1 & page = 1

Configuration File: <lookfor> ~ /Product_list (\ D +) _ (\ D +) \. htm </lookfor>
         <Sendto> ~ /Product_list.aspx? PID = $1 & amp; page = $2 </sendto>

& Amp: indicates the Connection Symbol when multiple parameters exist.

Set in the webpage: product_list + PID parameter + _ + Page parameter + ". htm"

When publishing to IIS, you must also handle the issue.

Right-click my computer> Manage> Expand services and applicationsProgram'--> Internet Information Service --> Find the shared directory --> right-click Properties --> click 'configuration' --> map to the following --> Find. aspx executable file path copy path --> Add --> paste path --> extension is ". html "--> then remove the check object check box. If the" OK "button becomes invalid, you can use the keyboard event to edit the path.

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.