我下载了M$的URLRewrite的例子回来,运行时它的根目录下有一个default.aspx文件,输入1后提交却不能重写URL,出现是:http://localhost/RewriterTester/ListProductsByCategory.aspx?

解决方案 »

  1.   

    要用ActionLessForm,在MS的示例中有个ActionLessForm的示例阿!你看看那个怎么用!
      

  2.   

    在web.config中配置对,就可以了
      

  3.   

    重写所涉及到的东西并不很多,基本的把config文件配置好,引入URLRewrite.dll就可以了!如仍有问题,贴出代码看看!
      

  4.   

    引入URLRewrite.dll
    相应代码web.config
    <?xml version="1.0" encoding="gb2312" ?>
    <configuration><configSections>
        <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
    </configSections>
      
       <RewriterConfig>
              <Rules>
                  <RewriterRule>
                       <LookFor>~/Sell/(.[0-9]*)\.html</LookFor>
                       <SendTo>~/Search/Search_Sell.aspx?id=$1</SendTo>
                  </RewriterRule>
                  <RewriterRule>
                       <LookFor>~/Sell/Search_Sell\.aspx</LookFor>
                       <SendTo>~/Search/Search_Sell.aspx</SendTo>
                  </RewriterRule>
                  <RewriterRule>
           <LookFor>~/Buy/(.[0-9]*)\.html</LookFor>
                       <SendTo>~/Search/Search_Buy.aspx?id=$1</SendTo>
                  </RewriterRule>
                  <RewriterRule>
           <LookFor>~/Buys/(.[0-9]*)\.html</LookFor>
                       <SendTo>~/Buys/Show.aspx?id=$1</SendTo>
                  </RewriterRule>
              </Rules>
         </RewriterConfig>
      
      <system.web>
      
    <httpModules>
       <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />
    </httpModules>
    .............
    _________________________________
    我浏览的路径
    http://localhost/Url/Search/Search_Sell.aspx
    有web.config设置得知,我想路径应为,但不是。
    http://localhost/Url/Sell/Search_Sell\.aspx
      

  5.   

    第三方工具ISAPI_Rewrite
    比MS的好用