我在http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx?mfr=true下载了源代码,然后把.dll在项目中引进来,然后在web.config里设置一下,就能实现url重写,我在百度搜索asp.net 重写url几乎每篇文章都这么写,我也这么去做,可是就是不能实现url????做过url兄弟帮帮看看,问题解决了立即揭贴!!

解决方案 »

  1.   

    ASP.NET 2.0: URL Mapping with RegEx Support
    http://pietschsoft.com/blog/post.aspx?postid=7621.1网上很多例子了.要注意IIS,web.config等的设置
      

  2.   

    同意楼上的,网上好多例子http://workgroup.cn/CS/blogs/aspnet/archive/2006/07/07/1441.aspx
      

  3.   

    是不是你的适配写的有问题?贴出来看看??或者你没把IIS配置里面的"确认文件是否存在的"勾去掉
      

  4.   

    注意把你要重写的url的后缀*.xxx要在IIS里做映射
      

  5.   

    ccwq(Wind Love Rove Forever) ( ) 
    ---------------------------------------------
    或者你没把IIS配置里面的"确认文件是否存在的"勾去掉,我来看看去掉,谢谢!!
      

  6.   

    littlelam(比菜鸟还要菜的鸟)(http://www.toaspx.com) ( ) 信
    -----------------
    已经影射了
      

  7.   

    "确认文件是否存在的"勾去掉还是不行
    __________________
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <configSections>
    <!-- The <configSections> element must contain a <section> tag for the <RewriterConfig> section element.
    The type of the section handler is RewriterConfigSerializerSectionHandler, which is responsible for
    deserializing the <RewriterConfig> section element into a RewriterConfig instance... -->
          <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
        </configSections>
      <RewriterConfig>
    <Rules>
    <!-- Rules for Product Lister -->
    <RewriterRule>
    <LookFor>~/Products/Default\.aspx</LookFor>
    <SendTo>~/ListCategories.aspx</SendTo>
    </RewriterRule>
    <RewriterRule>
    <LookFor>~/Products/Beverages\.aspx</LookFor>
    <SendTo>~/ListProductsByCategory.aspx?CategoryID=1</SendTo>
    </RewriterRule>
    <RewriterRule>
    <LookFor>~/Products/Condiments\.aspx</LookFor>
    <SendTo>~/ListProductsByCategory.aspx?CategoryID=2</SendTo>
    </RewriterRule>
    <RewriterRule>
    <LookFor>~/Products/Confections\.aspx</LookFor>
    <SendTo>~/ListProductsByCategory.aspx?CategoryID=3</SendTo>
    </RewriterRule>
    <RewriterRule>
    <LookFor>~/Products/Dairy\.aspx</LookFor>
    <SendTo>~/ListProductsByCategory.aspx?CategoryID=4</SendTo>
    </RewriterRule>
    <RewriterRule>
    <LookFor>~/Products/GrainsCereals\.aspx</LookFor>
    <SendTo>~/ListProductsByCategory.aspx?CategoryID=5</SendTo>
    </RewriterRule>
    <RewriterRule>
    <LookFor>~/Products/MeatPoultry\.aspx</LookFor>
    <SendTo>~/ListProductsByCategory.aspx?CategoryID=6</SendTo>
    </RewriterRule>
    <RewriterRule>
    <LookFor>~/Products/Produce\.aspx</LookFor>
    <SendTo>~/ListProductsByCategory.aspx?CategoryID=7</SendTo>
    </RewriterRule>
    <RewriterRule>
    <LookFor>~/Products/Seafood\.aspx</LookFor>
    <SendTo>~/ListProductsByCategory.aspx?CategoryID=8</SendTo>
    </RewriterRule>
    </Rules>
      </RewriterConfig>
     <system.web>
      <httpHandlers>
    <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
    </httpHandlers>
    </system.web>
       <system.windows.forms jitDebugging="true" />
    </configuration>
      

  8.   

    要在web.config设置httpModules,不是httpHandlers
      

  9.   

    gyf19(秋天的云)
    ----------------------------
    设置httpModules也不行,真是急死了
      

  10.   

    1:.html 要在IIS里设置一下,跟.aspx一样
    2:.dll文件放到bin里
    3:() 代表一个变量,对应一个$n如 <LookFor>~/Products/Seafood/([\d]*)\.html</LookFor>
      <SendTo>~/products.aspx?name=seafood&id=$1()里的正则表达式跟$1是对应的,有几个(),就对应几个$n...