From:  https://forums.asp.net/t/2096848.aspx?Session+variables+lost+after+the+call+of+Response+Redirect+method

[问题]

Hi Everyone,

In my asp.net application after I login, my session variables, which I set in login page, are getting lost after the call to Response.Redirect method.

After googling I found the below link elaborate the cause of the problem.

http://weblogs.asp.net/bleroy/Don_2700_t-redirect-after-setting-a-Session-variable-_2800_or-do-it-right_2900_

I really couldn't get the solution suggested in the above link.

I didn't get the error or the issue was not there for a month. It suddenly appeared yesterday and I'm unable to use my session variables if use Response.Redirect method, even with the second argument with 'false', ie. Response.Redirect(URL,false);

Why I got the error all of a sudden? And what is the solution?

[回答]

Hi ArunCode47,

Have you tried setting cookieless="true" in web.config? Check that enableSessionState hasn't been set to false in the web.config.

<configuration>
<system.web>
<pages enableSessionState="true">
<sessionState
cookieless="true"
regenerateExpiredSessionId="true"
timeout="30" />
</system.web>
</configuration>

ASP.NET Session State Overview

Cookieless ASP.NET

Best Regards,

Chris

Session variables lost after the call of Response.Redirect method的更多相关文章

  1. aspx在页面跳转(Response.Redirect)时丢失session问题及解决办法

    [问题描述] 假设a.aspx.cs页面保存有Session["empid"]="3",当a.aspx.cs通过Response.Redirect(" ...

  2. Response.Redirect("x.aspx);跳转后session为null的解决方法

    通常我们做登陆的时候都是登录成功后为管理员保存一些信息,一般都会写类似下面的代码 if(登录成功) { Session["xx"] = "user"; Resp ...

  3. ASP.NET Response.Redirect 丢失 Session的问题(作废,仅供参考)

    以前在做ASP.NET开发时一直没注意到一个问题,就是广泛使用的Response.Redirect方法并不会将服务器端在Response中新增或修改的Cookie返回给客户端浏览器,而网站的Sessi ...

  4. 关于session variables 和 global variables

    背景 有同学问到这样一个问题:原来的binlog格式是statement,为什么执行了 set global binlog_format='row' 和 set binlog_format='row' ...

  5. Response.Redirect()、Server.Execute和Server.Transfer的区别

    1.Response.Redirect(): Response.Redirect方法导致浏览器链接到一个指定的URL. 当Response.Redirect()方法被调用时,它会创建一个应答,应答头中 ...

  6. 1. Server.Transfer和Response.Redirect

    今天在使用ServerTransfer和Response.Redirect定位到当前页面来实现刷新页面时,发现了一些现象: 1.使用Response.Redirect刷新本页面,造成当前页面显示的数据 ...

  7. 页面跳转 Server.Transfer和 Response.Redirect的区别

    1.Server.Transfer 用于把处理的控制权从一个页面转移到另一个页面,在转移的工程中没有离开服务器内部控件(如request,session等)保存的信息不变.因此你能从a页面跳转到b页面 ...

  8. Response.Redirect(),Server.Transfer(),Server.Execute()的区别与网站优化

    转 http://blog.csdn.net/dannywj1371/article/details/10213631 1.Response.Redirect():Response.Redirect方 ...

  9. c#页面重定向,Server.Transfer 和 Response.Redirect

    Server.Transfer() 重定向发生在服务器端,把处理的控制权从当前页面转移到另一个页面,在转移的工程中没有离开服务器内部控件(如request,session等)保存的信息不变. 1.只能 ...

随机推荐

  1. 借助CSS Shapes实现元素滚动自动环绕iPhone X的刘海

    CSS代码: .box { max-width: 414px; height: 480px; border: solid #000; margin: auto; overflow: auto; } . ...

  2. 实现 js 数据类型的判断函数type

    type = (obj) => { const pass1 = typeof obj if (pass1 != 'object') return pass1 const pass2 = obj ...

  3. Ubuntu16.04中nginx除80之外其他端口不能访问

    不废话, 大多数都以为是ufw防火墙的问题. 但我的是因iptables防火墙, 坑死我了. 查了好多也没查到怎么在Ubuntu关闭iptables, 索性直接卸载 apt-get remove ip ...

  4. spring cloud (一、服务注册demo_eureka)

    首先我的博客记理论知识很少,大家对spring boot.spring cloud  .分布式 .微服务什么的一点概念都没有的还请先去百度看看理论,知道了是做什么用的,然后再写下demo ,这样学起来 ...

  5. Trident中的过滤与函数的区别

    1.共同点 都需要实现storm.trident.operation.Function接口 2.不同点 其中函数有发射这个步骤. .each(new Fields("orderTime&qu ...

  6. react学习二 生命周期

    转自:https://www.cnblogs.com/gdsblog/p/7348375.html react 中compent getDefaultProps object getDefaultPr ...

  7. mysql group_concat时间用法

    第一张表的worksId在第二张表中对应多条数据,需要将每条数据的日期作为结果查询出来,一个作为“初审时间”,另一个作为“复审时间”: 可以使用group_concat 和 group by 来进行分 ...

  8. JS获取验证码后倒计时不受刷新及关闭影响

    HTML部分 <input type="button" id="code_btn" value="获取验证码"> JS部分 // ...

  9. linux下执行.sh文件的方法和语法

    linux下执行.sh文件的方法    .sh文件就是文本文件,如果要执行,需要使用chmod a+x xxx.sh来给可执行权限.       是bash脚本么   可以用touch test.sh ...

  10. Context家族

    --摘自<android插件化开发指南> 1.ContextWrapper只是一个包装类,没有任何具体的实现,真正的逻辑都在ContextImpl里面 2.应用程序中包含多个Context ...