//:
//QQ:516608612
//Email:swebook@126.com


վ£ҪISSַӳ䣡

IISϢվϵҼ

Ŀ¼ѡáӳ䣬

ִг룺

c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll

չ.htm

ΪGET,HEAD,POST,DEBUG

ļǷڿɲѡ
//masterļ¼ʵQQϵ
<script language="javascript" type="text/javascript" src="http://www.54kfqq.com/User/lhjsjbbs8837/jqqonline.html"></script>

///ԭ£


Asp.Netв޸IISʵURLд,֧չչ2009-08-11 15:36˵iisҪΪʵòiis޵ʱ򣬲isapʵھ̬ĳʵַʽҪʵֵЧǣտ

12345.html

滻

show.aspx?id=12345ĵַ

Ҳʵְٶȿռ

http://hi.baidu.com/wu1987116

滻

http://hi.baidu.com/index.aspx?UserName=wu1987116

,֧չչ

ҪĲֻ顣
һweb.configļ
ӵַ
urlrewrite.dll

URLRewriter:http://download.microsoft.com/download/0/4/6/0463611e-a3f9-490d-a08c-877a83b797cf/MSDNURLRewriting.msi

ذװbinĿ¼ҵURLRewriter.dllļ

˿ʼʵʩ
һurlrewrite.dllصwebĿ¼ȥĶСǷbinġȻãurlrewrite.dllý
ڶ޸web.config
һҪ޸ļطҪעλǲͬ

1 web.configļм´,עҪ<configuration>, <appSettings/>
<connectionStrings/> <system.web>治Ȼ

   <configSections>
    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
  </configSections>



<section name="RewriterConfig" 
type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />

ָý"RewriterConfig"ĴΪURLRewriter.Config.RewriterConfigSerializerSectionHandlerbinĿ¼µURLRewriter.dllļ

2 web.configļеsystem.webڵ¼´

    <httpHandlers>
      <add verb="*" path="*.html"
            type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
      <add verb="*" path="*"
            type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
   </httpHandlers>

δ˼ǣļչΪ.htmlչ(չ,*.html,Ϊλȴ)ļ HTTP ӳ䵽 URLRewriter.RewriterFactoryHandler,ע˳,ϵִ,path="*"Ļ,htmlӳЧ,沽ӳ䵽Ǹҳ

3 дurl 

        1һ ͬǷ<configuration>ڵ

     ؼ


<RewriterConfig>
    <Rules>
      <RewriterRule>
        <LookFor>~/(.+).html</LookFor>
        <SendTo>~/Shownews.aspx?ShowID=$1</SendTo>
      </RewriterRule>
      <RewriterRule>
        <LookFor>~/(.+)</LookFor>
        <SendTo>~/blog.aspx?UserName=$1</SendTo>
      </RewriterRule>
    </Rules>
  </RewriterConfig>
Ч:http://127.0.0.1/123.htmlʱ,ʵʷʵhttp://127.0.0.1/Shownews.aspx?ShowID=123

        http://127.0.0.1/ַʱ,ʵʷʵhttp://127.0.0.1/blog.aspx?UserName=ַ

        ע2,3еӳ˳

йؼurlת

<LookFor>~/(.+).html</LookFor>

<SendTo>~/Shownews.aspx?ShowID=$1</SendTo>
    ˼ǰѵһ·תһ·<LookFor>еʽǵڶеĲ$1 .


ͬҲ$2 $3ʾ<LookFor>еڶ еĲ

:

<ReWriterUrls>
          <rule>
               <old>(.*)/TestUrlRe/file(.*)/(.*)\.html</old>
               <new>../WebForm1.aspx?id=$2&amp;type=$3</new>
          </rule>
          <rule>
               <old>(.*)/TestUrlRe/t(.*)/(.*)\.html</old>
               <new>../WebForm1.aspx?tid=$2&amp;ttype=$3</new>
          </rule>
</ReWriterUrls>

ҳпд
<a href="news_<%=newsid%>.html" target="_blank">ű</a>

ͿʵURLдˣҪעǣվĻᷢURLдпܻʧЧʧЧĻҪһIIS
IISĿ¼--ӳ-롱ͨӦóӳ-ѡC:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dllȻѹѡȥһҪȥȻȷ
֮󣬾Ϳˡ
 

