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. 使用 Django-debug-toolbar 优化Query 提高代码效率

    一段程序执行效率慢,除了cpu计算耗时外,还有一个很重要的原因是SQL的Duplicated过多,使用Django-debug-toolbar能够快速找出哪些地方的SQL可以优化,提高程序执行效率 1 ...

  2. laravel启动过程简单解析

    :first-child{margin-top:0!important}img.plugin{box-shadow:0 1px 3px rgba(0,0,0,.1);border-radius:3px ...

  3. HYSBZ 4034 【树链剖分】+【线段树 】

    <题目链接> 题目大意: 有一棵点数为 N 的树,以点 1 为根,且树点有权值.然后有 M 个 操作,分为三种: 操作 1 :把某个节点 x 的点权增加 a . 操作 2 :把某个节点 x ...

  4. "放管服"改革 清单

    全国31个省份已全部公布省级部门权力清单,29个省份公布了责任清单:已有57个国务院部门公布了权力清单:自贸试验区的负面清单已从2013年的193项减至目前的122项…… 2013年以来,党中央.国务 ...

  5. linux 学习笔记 tail 命令

    #tail -f -n 100 catalina.out 含义:从文件尾部监视catalina.out文件  主要看尾部100行 #tail -f -n 100 catalina.out > n ...

  6. shell编程第四天

  7. angular笔记_2

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  8. 潭州课堂25班:Ph201805201 django 项目 第二十一课 文章主页 新闻列表页面功能 (课堂笔记)

    新闻列表页功能 1.分析 业务处理流程: 判断前端传的标签分类id是否为空,是否为整数.是否超过范围 判断前端传的当前文章页数是否为空,是否为整数.是否超过范围 请求方法:GET url定义:/new ...

  9. 使用Three.js为QQ用户生成3D头像阵列

    东西其实比较简单,就是输出某一范围内QQ账号的3D头像 涉及的技术主要是Three.js的基本使用 而后通过腾讯的接口异步并发请求QQ用户头像,Canavs作图生成Texture应用在球体上 需要注意 ...

  10. VueJs记录

    v-model是双向绑定,v-bind用来绑定属性,也可以简写成为: