Void context_beginrequest (Object sender, eventargs e) {httpapplication application = (httpapplication) sender; httpcontext context = application. context; httpresponse response = application. response; string Path = context. request. path; string file = system. io. path. getfilename (PATH); RegEx = new RegEx (@ "(\ W +) _ (\ W +) (\ d).html", regexoptions. compiled); RegEx regex2 = new RegEx (@ "(\ w+)).html", Rege Xoptions. compiled); match = RegEx. match (File); match match2 = regex2.match (File); If (match2.success) {string url = match2.groups [1]. value; context. rewritepath (URL + ". aspx ");} If (match. success) {string url = match. groups [1]. value; string parm = match. groups [2]. value; string parmvalue = match. groups [3]. value; string rewritepath = URL + ". aspx? "+ Parm +" = "+ parmvalue; context. rewritepath (rewritepath) ;}# region ihttpmodule member public void dispose () {Throw new notimplementedexception ();} public void Init (httpapplication context) {context. beginrequest + = new eventhandler (context_beginrequest);} # endregion
- <Httpmodules>
-
- <Add Name="Urlrewriter" Type="Urlrewriter"/>
- </Httpmodules>
If you want to implement pseudo-static ing in iisconfiguration, .html ing
Source: http://blog.csdn.net/zhoufoxcn/archive/2009/07/14/4346356.aspx