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. BZOJ3531 [Sdoi2014]旅行 树链剖分 线段树

    原文链接:http://www.cnblogs.com/zhouzhendong/p/8080189.html 题目传送门 - BZOJ3531 题意概括 一棵树,n个节点,每一个节点两个值,一个颜色 ...

  2. 使用aws中国的s3时,制订bucket poicy时注意注意……

    { "Version": "2012-10-17", "Statement": [ { "Sid": "Pub ...

  3. SQL注入——SQL Injection

    本文部分内容转自:https://www.cnblogs.com/rush/archive/2011/12/31/2309203.html http://www.diybl.com/course/7_ ...

  4. Enrolment注册插件

    自moodle2.0注册插件必须继承 lib/enrollib.php的  enrol_plugin 抽象类:这个基类包含所有标准方法和开发人员文档 课程注册信息存储在enrol和user_enrol ...

  5. go get 无反应、访问github.com速度慢、没反应问题的解决方案

    go get 无反应.访问github.com速度慢.没反应问题的解决方案     昨天晚上装了个虚拟机,Centos7 安装都正常,网络访问也正常,但是打算安装beego的时候,把我给噎着了,无论是 ...

  6. c++基本数据类型及其取值范围

    #include<iostream> #include<string> #include <limits> using namespace std; int mai ...

  7. 003.MongoDB主要概念

    一 对比关系 SQL术语/概念 MongoDB术语/概念 解释/说明 database database 数据库 table collection 数据库表/集合 row document 数据记录行 ...

  8. 使用CCS调试基于AM335X的SPL、Uboot(原创)

    使用CCS调试基于AM335X的SPL.Uboot 一.开发环境 1.硬件平台:创龙AM3359核心板 2.SDK版本:ti-processor-sdk-linux-am335x-evm-03.00. ...

  9. PA2015

    题目链接 我按AC排序后做的 4291 傻逼题不多说 4292 f(n)最大也很小,暴力枚举就好了 4293 这是个线段树的题,说到这应该会了 4294 Claris:斐波那契数列模\(10^m\)的 ...

  10. 2154 杭电 数学规律 ACM

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=2154 很简单的找规律的数学题目: 思路:因为挑完N次后都要跳回A,所以相当于挑N-1次后必须留在B C区域 ...