Implementation of ASP. NET pseudo-static pages and configuration of pseudo-static pages in iis7.0

Source: Internet
Author: User
The pseudo-static mode is actually to rewrite the URL. It is not clear how to configure IIs before. It is normal to run vs in the project. When the website is published, the pseudo-static mode in IIS becomes invalid, if you cannot access the service, a 404 (nonexistent) error will be reported, and other error prompts will be reported. I searched the service online for several hours today, but all of them failed, most of the configurations on the Internet are in iis6.0 and earlier versions, but the configurations in iis7.0 and later versions won't work. If you don't talk about them, just start with the question:

First, you need to reference two DLL files in your project:

Urlrewriter. dll

Actionlessform. dll

Which of the following is true?Urlrewriter. dll, but if you want to implement paging, you must use this actionlessform. dll

1. AddUrlrewriter. dll

1. (ensure that pseudo-static data can be run in the vs project) download a urlrewriter. dll Program Set, 1: Example... (for example, the. ASPX page is represented in .html. In the Web. config file --> Add the following nodes <configsections>
<Section name = "rewriterconfig" requirepermission = "false" type = "urlrewriter. config. rewriterconfigserializersectionhandler, urlrewriter"/> </configsections> <rewriterconfig>
<Rules>
<Rewriterrule> <! -- A parameter->
<Lookfor> ~ /CN/SS _ (. [\ D] *) \. html </lookfor>
<Sendto> ~ /CN/news. aspx? Id = $1 </sendto>
</Rewriterrule> <! -- Transfer two parameters -->
<Lookfor> ~ /CN/SS _ (. [\ D] *) 0 (. [\ W] * ).html </lookfor> <! --(. [\ D] *) (. [\ W] * ).html or SS _,(. [0-9] *), (. [0-9] *) \. HTML -->
<Sendto> <! [CDATA [~ /CN/news. aspx? Id = $1 & SID = $2]> </sendto>
</Rewriterrule> <! -- Three parameters -->
<Lookfor> ~ /CN/SS _ (. [\ D] *) 0 (. [\ W] *) 0 (. [\ W] * ).html </lookfor> <sendto> <! [CDATA [~ /ZH-CN/news. aspx? Id = $1 & SID = $2 & n_id = $3]> </sendto>
</Rewriterrule>
<Add verb = "*" Path = "*. aspx" type = "urlrewriter. rewriterfactoryhandler, urlrewriter"/>
<Add verb = "*" Path = "*. html "type =" urlrewriter. rewriterfactoryhandler, urlrewriter "/>

 

2. Add Actionlessform. dll

1. Add actionlessform. CS class

Namespace Actionlessform {
Public   Class Form: system. Web. UI. htmlcontrols. htmlform
{
Protected   Override   Void Renderattributes (htmltextwriter writer)
{
Writer. writeattribute (
" Name " , This . Name );
Base . Attributes. Remove ( " Name " );
Writer. writeattribute (
" Method " , This . Method );
Base . Attributes. Remove ( " Method " );
This . Attributes. Render (writer );
Base . Attributes. Remove ( " Action " );
If ( Base . ID ! =   Null )
Writer. writeattribute (
" ID " , Base . Clientid );
}}}

 

After creating and compiling this class, you must first add it to the references folder of the Web application to use it in the ASP. NET web application.

Then, use it to replace the htmlform class by adding the following content at the top of the ASP. NET webpage:

<% @ Register tagprefix = " SKM " Namespace = " Actionlessform "
Assembly
= " Actionlessform " %>
Then
< Form runat = " Server " > Replace (if any):
< SKM: Form ID = " Form1 " Method = " Post " Runat = " Server " >
And
</ Form > Replace the tag:

</SKM: Form>

======>> Successful!

 


Author:Mr. yoyior
Source: http://www.cnblogs.com/yoyiorlee/

The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent andArticleThe original text connection is displayed at an obvious location on the page. If you have any problems, you can useYoyiorlee@gmail.comThank you very much for contacting me.

Border-bottom: # e0e0e0 1px dashed; border-left: # e0e0e0 1px dashed; padding-top: 10px;
Padding-Right: 10px; padding-bottom: 10px; padding-left: 10px;
Font-family:; font-size: 12px; ">
Feedback on Article quality, you can comment through the quick channel:



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.