Configure pseudo-static rules in Asp.net

Source: Internet
Author: User

Step 2: Add a reference to the urlrewriter assembly in the website project.

1 <configsections> </configsections>

<! -- 1. URL rewriting] register the configuration node rewriterconfig. Under configuration, the first position of the configsections node -->
<Configsections>
<Section name = "rewriterconfig" requirepermission = "false" type = "urlrewriter. config. rewriterconfigserializersectionhandler, urlrewriter"/>
</Configsections>
<! -- 2. Confirm the configuration rule: loookfor: The pattern to be searched, sendto: string to be used to replace the pattern -->
<Rewriterconfig>
<Rules>
<Rewriterrule>
<Lookfor> ~ /Login.html </lookfor>
<Sendto> ~ /Login. aspx </sendto>
</Rewriterrule>
</Rules>
</Rewriterconfig>

<! -- 3. comment out the <Httpmodules>
<Add type = "urlrewriter. modulerewriter, urlrewriter" name = "modulerewriter"/>
</Httpmodules>

Part 4: Configure iis7.5 or iis7.0

Create an application pool: Name: any such as webapp; select the Net Framework Version (If your website is 2.0, select 2.0, and my website is 4.0) Here I select net
Framwork v 4.030319. The managed pipeline mode is temporarily set to the integration mode. After the following settings are complete, set the managed pipeline mode to the classic mode. If the following settings are completed without setting the application to the classic mode, the pseudo-static function can be implemented, but the page style image cannot be properly displayed, which is the key to setting.

Create a website and set the application pool of this site to webapp.

Select your site, such as website, and switch to the function view. Double-click handler ing. In the operation column on the right of the window, perform the following operations.

, [Add script ing]-path :*. HTML. the executable file is C:/Windows/Microsoft. net/framework/v4.0.30319/aspnet_isapi.dll Note: If your website is 2.0. The executable file is C:/Windows/Microsoft. NET/framework/v2.0.50727/aspnet_isapi.dll. Name: arbitrary, such as HTML.
3.2. [add wildcard script ing] The Request Path is *. The executable file is exactly the same as the 3.1 file, and the name is arbitrary, such as: All.

, [Managed handler ing] (Path: * Executable File: system. Web. UI. pagehandlerfactory name, for example, HTML-integrate)

Double-click the website to switch to the site function view. Double-click the module. After opening the window, under the operation column on the right, click Add managed module-> name, for example, all type: urlrewriter. modulerewriter.
In addition, you can refer to the preceding options for sending request calls only to the Asp.net application or hosting handler. (Remember to check it out ).

Last step: double-click the application pool of iis7.0 or 7.5. Find the webapp application pool in the application pool list. Double-click it. Set the managed pipeline mode of the webapp application pool to the classic mode.

Of course, there is a simpler way to configure iis7.0 and iis7.5. Install the official Microsoft URL package on the server and import the configuration rule file on the server,

Rewriterule ^ news/([0-9] +)/. html $ news/XX. aspx? Id = $1 # comment

....

The file name suffix is. htaccess: Pause the website, click urlwriter, and import the rule application. Of course, in the development process, to facilitate testing, it is best to combine the two methods and then use them on the web. in config, rewrite or delete the related urlwriter configuration item!

Http://www.passji.com

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.