首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

想问个URL重写的有关问题

2012-02-15 
各位高手想问个URL重写的问题.在线等系统是XP的..我在IIS中的ISAPI筛选器中加了aspnet_isapi..在bin中引用

各位高手想问个URL重写的问题.在线等
系统是XP的..我在IIS中的ISAPI筛选器中加了aspnet_isapi..
在bin中引用了URLRewriter.dll跟ActionlessForm.dll
web.config中是这样子写的.
<configuration>
   
    <configSections>
        <section   name= "RewriterConfig "   type= "URLRewriter.Config.RewriterConfigSerializerSectionHandler,   URLRewriter "   />
    </configSections>
    <RewriterConfig>
        <Rules>
            <RewriterRule>
                <LookFor> list-(\d).aspx </LookFor>
                <SendTo> list.aspx?id=$2 </SendTo>
            </RewriterRule>
            <RewriterRule>
                <LookFor> class-(\d).aspx </LookFor>
                <SendTo> calss.aspx?id=$2 </SendTo>
            </RewriterRule>
            <RewriterRule>
                <LookFor> Default.aspx </LookFor>
                <SendTo> Default.asp </SendTo>
            </RewriterRule>
            <RewriterRule>
                <LookFor> Flist-(\d).aspx </LookFor>
                <SednTo> Flist.aspx?id=$2 </SednTo>
            </RewriterRule>
        </Rules>
    </RewriterConfig>
    <appSettings>
        <add   key= "ConnectionString "   value= "Data   Source=.;Initial   Catalog=shop;Uid=sa;pwd=19850914; "/>
    </appSettings>
<httpHandlers>  
  <system.web>
            <add   verb= "* "   path= "*.aspx "   type= "URLRewriter.RewriterFactoryHandler,   URLRewriter "   />
        </httpHandlers>
    </system.web>
不知道哪里还要作修改的?哪里写错了?网上找的那些我都看过了.我也按他们的作过了.可就是不行..请问为什么??
在线等...

[解决办法]
http://www.jeast.net/student/guijishu/archives/2006/2432.html
可能您的webconfig没有配置好,这个其实网上很多的,你查一下就可以了,没什么难度在
[解决办法]
<?xml version= "1.0 "?> <!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”-> “Asp.Net 配置”选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
\Windows\Microsoft.Net\Framework\v2.x\Config 中
--> <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>
<appSettings>
<add key= "CrystalImageCleaner-AutoStart " value= "true " />
<add key= "CrystalImageCleaner-Sleep " value= "60000 " />
<add key= "CrystalImageCleaner-Age " value= "120000 " />
</appSettings>
<RewriterConfig>
<Rules>
<!-- Rules for Product Lister -->
<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>
</Rules>
</RewriterConfig>
<system.web>
<!--*******************************************************************************
Comment either the <httpModules> or <httpHandlers> section to use
URL rewriting... Refer to the article for a discussion on the pros and
cons of each approach...
*******************************************************************************-->
<httpModules>
<add type= "URLRewriter.ModuleRewriter, URLRewriter " name= "ModuleRewriter "/>
</httpModules>
<!-- <httpHandlers>
<add verb= "* " path= "*.aspx " type= "URLRewriter.RewriterFactoryHandler, URLRewriter " />
</httpHandlers> -->
<!--
设置 compilation debug= "true " 将调试符号插入
已编译的页面中。但由于这会
影响性能,因此只在开发过程中将此值
设置为 true。
-->
<compilation defaultLanguage= "c# " debug= "true ">
<compilers>
<compiler language= "c# " type= "Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089 " extension= ".cs " compilerOptions= "/d:DEBUG;TRACE "/>
</compilers>
<assemblies>
<add assembly= "CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304 "/>
<add assembly= "CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304 "/>
<add assembly= "CrystalDecisions.ReportSource, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304 "/>
<add assembly= "CrystalDecisions.Enterprise.Framework, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304 "/>
<add assembly= "CrystalDecisions.Enterprise.Desktop.Report, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304 "/>
<add assembly= "CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304 "/>
<add assembly= "CrystalDecisions.Enterprise.InfoStore, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304 "/> <add assembly= "CrystalDecisions.ReportAppServer.ClientDoc, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 "/> </assemblies> </compilation>
<!--
通过 <authentication> 节可以配置 ASP.NET 使用的
安全身份验证模式,
以标识传入的用户。
-->


<authentication mode= "Windows "/>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。

<customErrors mode= "RemoteOnly " defaultRedirect= "GenericErrorPage.htm ">
<error statusCode= "403 " redirect= "NoAccess.htm " />
<error statusCode= "404 " redirect= "FileNotFound.htm " />
</customErrors>
-->
<httpHandlers> <add verb= "GET " path= "CrystalImageHandler.aspx " type= "CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 "/> </httpHandlers> </system.web>
</configuration>
自己对着看吧,只要配置好了就没问题,我刚试了
[解决办法]
楼主,请参考这里,不要走弯路,ActionForm这个在.net 2.0有可进行处理,不需要重写方法。
http://blog.joycode.com/jasper/archive/2007/01/16/91589.aspx
http://blog.joycode.com/scottgu/archive/2007/03/01/94004.aspx

热点排行