This component provided by Microsoft has been compiled, no need to write code, use it directly :) For web.config: In
<
Configsections
>
<
section
Name
= "RewriterConfig"
Type
= "Urlrewriter.config.rewriterconfigserializersECTIONHANDLER, URLREWRITER"
/>
Configsections
>
Plus in
<
RewriterConfig
>
<
Rules
>
<
Rewriterrule
>
<
Lookfor
>
~ / News, (D {4}), (D {1, 2}), (D {1, 2}), (D {1, 9}). ASPX
Lookfor
>
<
Sendto
>
~ / news_view.aspx?
Newsid = $ 4
Sendto
>
Rewriterrule
>
<
Rewriterrule
>
<
Lookfor
>
~ / (d {4}) / (d {2}) / default.aspx
Lookfor
>
<
Sendto
>
~ / news_view.aspx? Year = $ 1 & Month = $ 2
]]]]
Sendto
>
Rewriterrule
>
Rules
>
RewriterConfig
>
Plus: add:
<
Httpmodules
>
<
Add
Type
= "Urlrewriter.ModuleRewriter, urlrewriter"
Name
= "ModuleWriter"
/>
Httpmodules
>
Treat a link: news.aspx
Private
Void
Page_load
Object
Sender, System.EventArgs E)
{// Place the user code here to initialize the page DATATABLE DT = New DataProvider (). GetnewstoIndexpage (1); // Format URL URLFORMAT FORMATS = New urlFormat (); lbnews.text = "