首页 > Web开发 > 详细

IIS集成模式下,URL重写后获取不到Session值

时间:2015-12-21 18:01:40      阅读:295      评论:0      收藏:0      [点我收藏+]

近期给公司网站添加了伪静态功能,但是今天发现了在伪静态的页面中,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>

 

IIS集成模式下,URL重写后获取不到Session值

原文:http://www.cnblogs.com/h-change/p/5063905.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!