zoukankan      html  css  js  c++  java
  • asp.net3.5sp1WebForm使用路由

    第一步:创建一个类,并集成自IRouteHandler,实现接口中的方法.

    第二步:在Application_Start中注册Route

    第三步: 配置Web.Config:

    1.在<system.web>中添加

    <httpModules>  

     <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />        

    </httpModules>

    下面为了为了支持iis7

    2、在<system.WebServer>中添加

      <modules runAllManagedModulesForAllRequests="true">  

     <remove name="UrlRoutingModule"/>  

    <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 

    </modules> 

     <handlers>  

     <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web,Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" /> 

     </handlers>  

    或者

    1. System.Web->HttpModules->

    <add

    name="UrlRoutingModule"

    type="System.Web.Routing.UrlRoutingModule,System.Web.Routing,

    Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35" />

    2. system.webServer->modules->

    <add

    name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,System.Web.Routing,Version=3.5.0.0,

    Culture=neutral,PublicKeyToken=31BF3856AD364E35" />

    3. system.webServer->handlers->

    <add

    name="MyRoutingHandler"

    verb="*"

    path="UrlRouting.axd"

    type="XXX.MyRoutingHandler"/>

    如果sesstion不能用

    参考http://stackoverflow.com/questions/218057/httpcontext-current-session-is-null-when-routing-requests

  • 相关阅读:
    ado.net(增删改)
    窗体基础WINFORM
    SQL函数类的操作,增加,查询
    SQL数据库,增加查询修改以及防sql写入攻击
    SQL数据库--数据访问
    单列模式
    SQL数据库基础————委托
    SQL数据库基础知识——抽象类
    SQL数据库——静态成员
    面向对象
  • 原文地址:https://www.cnblogs.com/LYunF/p/2767706.html
Copyright © 2011-2022 走看看