当前位置:编程学习 > C#/ASP.NET >>

关于urlrewrite的配置 这是发的第三个贴了 在线等

<?xml version="1.0"?>
<configuration>
  
  <configSections >
    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
  </configSections>

  <RewriterConfig>
    <Rules>
      <RewriterRule>
        <LookFor>~/Default\.html</LookFor>
        <SendTo>~/Default.aspx</SendTo>
      </RewriterRule>
    </Rules>
  </RewriterConfig>

  <system.web>
    <httpModules>
      <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
    </httpModules>
    <httpHandlers>
      <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
      <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
    </httpHandlers>
    <compilation debug="true"/>
  </system.web>
</configuration>




信息提示

未能找到元素“RewriterConfig”的架构信息。
未能找到元素“Rules”的架构信息。
未能找到元素“RewriterRules”的架构信息。
未能找到元素“LookFor”的架构信息。
未能找到元素“SendTo”的架构信息。
--------------------编程问答-------------------- 帮顶啊…… --------------------编程问答-------------------- 包含RewriterConfig的Assembly URLRewriter在你的bin目录中吗? --------------------编程问答-------------------- 参考下
http://www.codeproject.com/KB/aspnet/URL_Rewriting.aspx
的文章和代码吧 --------------------编程问答-------------------- URLRewriter我是在论坛上下的 放在了bin目录下了 --------------------编程问答-------------------- 添加引用.... --------------------编程问答--------------------
引用 5 楼 xiaogangqq123456 的回复:
添加引用....

我是通过添加引用  到bin目录下的
--------------------编程问答-------------------- 好像没啥问题啊。

参考:
http://starlinmj.blogspot.com/2010/03/unrecognized-configuration-section.html

--------------------编程问答--------------------
引用 7 楼 findcaiyzh 的回复:
好像没啥问题啊。

参考:
http://starlinmj.blogspot.com/2010/03/unrecognized-configuration-section.html

你给的网址打不开
--------------------编程问答-------------------- 你发了好多贴啊

从你的描述来看不出什么问题,“未能找到元素”这个应该是没有关系的。

你直接输入Default.aspx这个url看看页面能出来吗?

你的url是什么?服务器在哪里?在本机试的还是在其它服务器上?
--------------------编程问答--------------------  <configSections >必须是configuration 元素的第一个子元素

你在 <configSections >之前有没有其它的配置语句? --------------------编程问答-------------------- 我也遇见过,不过从网上找的以下资料管用了,你看按步骤能管用不
1、已将 URLRewriter.dll 拷贝到 bin 文件夹下。 

2、修改了 web.config 文件,具体如下: 

<!-- UrlRewriter for .net2.0 配置第一步(共三步) 要放在<configuration>子节点第一个位置--> 
<configSections>
    <section name="RewriterConfig"
    type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
  </configSections> 

<!-- UrlRewriter for .net2.0 配置第二步(共三步) --> 
<!-- 地址重写规则 --> 
<!-- 奇怪:这里配置的重写规则不起作用?????? --> 
<RewriterConfig>
       <Rules>
           <!-- 首页重写规则 -->
           <RewriterRule>
               <LookFor>~/default </LookFor>
               <SendTo>~/default.aspx </SendTo>
            
      </RewriterRule>

           <!-- 详细页面重写规则 -->
           <RewriterRule>
               <LookFor>~/([a-zA-Z0-9]*)\.aspx </LookFor>
               <SendTo>~/item.aspx?guid=$1 </SendTo>
            
      </RewriterRule>

           <!-- 类别页面重写规则 -->
           <RewriterRule>
               <LookFor>~/category/(\d{1}) </LookFor>
               <SendTo>~/category.aspx?id=$1 </SendTo>
            
      </RewriterRule>
        
    </Rules>
  </RewriterConfig>

<!-- UrlRewriter for .net2.0 配置第三步(共三步)放在<system.web> --> 
<!-- 教程说可以使用 HTTP 模块或者 HTTP 处理程序来执行 URL 重写,这里使用了HTTP 模块进行处理 --> 
<!-- 
   <httpHandlers> 
     <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" /> 
   </httpHandlers> 
--> 
<httpHandlers>
      <add verb="*" path="*.aspx"
           type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
    </httpHandlers> 
--------------------编程问答-------------------- 应该是没添加引用
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,