ActionlessForm.dll------used to process postbacks
URLRewriter.dll-----is a URL rewrite component that Microsoft has packaged
Add a reference----
Specific instructions please go and see
http://msdn.microsoft.com/zh-cn/library/ms972974.aspx#XSLTsection123121120120
Much better than I can say.
The specific use method:
First Web.config configuration:
Copy Code code as follows:
<?xml version= "1.0"?>
<configuration>
< configsections>
<section name= "Rewriterconfig" type= " URLRewriter.Config.RewriterConfigSerializerSectionHandler,
Urlrewriter "/>
</configSections>
<RewriterConfig>
<Rules>
<RewriterRule>
<lookfor>~/listcategories\.aspx</ Lookfor>
<SendTo>~/Default.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<lookfor>~/(\d+) \.html</lookfor>
<SendTo>~/Cover.aspx?id=$1</SendTo>
</ Rewriterrule>
</Rules>
</RewriterConfig>
<system.web>
& Lt;compilation debug= "true"/>
</system.web>
</configuration>
The main configuration of the code is these. Others are added according to their own needs and versions of. Net.
Then default.aspx,cover.aspx, create a new 2 page
Default.aspx:
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "_default"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> Untitled Page </title>
<body>
<form id= "Form1" runat= "Server" >
<div>
<a href= "Listcategories.aspx" >ListCategories.aspx</a>
<a href= "30.html" >30.html</a>
</div>
</form>
</body>
Cover.aspx:
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Cover.aspx.cs" inherits= "Cover"%>
<%@ Register tagprefix= "SKM" namespace= "Actionlessform" assembly= "Actionlessform"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>Cover</title>
<body>
<skm:form id= "Form1" runat= "Server" >
<div>
Cover page
<asp:button id= "Button1" runat= "Server" text= "button"/>
</div>
</skm:form>
</body>
Cover.aspx.cs:
Copy Code code as follows:
Using System;
Using System.Collections;
Using System.Configuration;
Using System.Data;
Using System.Linq;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.HtmlControls;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Xml.Linq;
public partial class Cover:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
if (request.querystring["id"] = = null)
{
Response.End ();
}
Else
{
int id = Convert.ToInt32 (request.querystring["id"]);
Response.Write (ID);
}
}
}
Also go to the IIS settings:
That way, pseudo static can be used.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll---This is the path above.
Browse Default.aspx page
Listcategories.aspx-the page is not actually on the server. The content inside it is default.aspx, because the configuration file has a set of
It was a bit messy.
This example is basically the same as Microsoft's rewrite URL. It's a little simplistic, huh?