zoukankan      html  css  js  c++  java
  • IIS集成模式下,URL重写后获取不到Session值

    近期给公司网站添加了伪静态功能,但是今天发现了在伪静态的页面中,Session值是获取不到的。

    原因是在伪静态请求的时候,Session请求被“过滤”掉了。

    开始是把web.config文件中的modules节点添加runAllManagedModulesForAllRequests="true"属性。

    <modules runAllManagedModulesForAllRequests="true">
       <add name="URLModule" type="TravelOnline.Web.Module.URLModule"/>
       <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
    </modules>

    这种方法是把所有的请求都传输给处理伪静态的类中,虽然Session是取到了,然而并不可取。

    最后是在modules节点中,添加Session状态模块。

    <modules>
       <add name="URLModule" type="TravelOnline.Web.Module.URLModule"/>
       <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
       <remove name="Session"/>
       <add name="Session" type="System.Web.SessionState.SessionStateModule"/>
    </modules>

    作者:黄昌
    出处:http://www.cnblogs.com/h-change/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。

  • 相关阅读:
    SQLite-SQLiteDatabase 数据库实例练习
    全局配置一个ajax的错误监控
    文件上传&&验证文件格式
    CSS3 resize 属性
    select change()
    window.location.Reload()和window.location.href 区别
    条件检索
    jQuery $.ajax传递数组的traditional参数传递必须true 对象的序列化
    jquery中attr方法和prop方法的区别
    resize
  • 原文地址:https://www.cnblogs.com/h-change/p/5063905.html
Copyright © 2011-2022 走看看