会话清除调试ASP.NET时结束,但开发和测试服务器上正常工作 [英] Session clears ends when debugging ASP.NET but works fine on the dev and test server

查看:178
本文介绍了会话清除调试ASP.NET时结束,但开发和测试服务器上正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,即会话的回发后,当我调试它在Visual Studio 2010中结束

I'm having a strange issue where the session ends after a postback when I debug it in visual studio 2010.

我存储在第一页上的会话的变量。它保持其在接下来的页面值,但之后,它会丢失。它返回一个空值。奇怪的是,当我确切的code复制到开发或测试的服务器,它工作正常...

I store a variable in a session on the first page. It keeps its value in the next page but after that it gets lost. It returns a null value. The strange thing is when i copy the exact code to the dev or test servers, it works fine...

任何想法可能是这样吗?谢谢。

Any ideas what could be happening? Thanks.

更新结果
在code是相当简单的。我有一个的Default.aspx 页面,在这里我设置会话变量:

UPDATE
The code is fairly simple. I have a default.aspx page where I'm setting a session variable:

 HttpContext.Current.Session["PurchaseOID"] = purchaseOID;

当我点击'下一步'Default.aspx页面重定向到一个页面Information.aspx。其他用户信息收集此页(使用DevEx preSS控制)上。当我点击下一步,在此页面上的会话变量PurhcaseOID在页面加载返回null。

When I click 'Next' the Default.aspx page redirects it to a Information.aspx page. Additional user information is gathered on this page (using DevExpress controls). When I click 'Next' on this page the session variable "PurhcaseOID" returns null on page load.

protected void Page_Load(object sender, EventArgs e)
{
      if(HttpContext.Current.Session["PurchaseOID"] == null){
        throw new Exception("error!");
      }
}

请告诉我奇怪的是,在第一次加载页面时会话保持。但在回发,它失去了它的变量。此外,这是一些刚开始发生。我一直对这个code一个月左右,它已经工作的罚款。当我部署这个确切code到我们的开发或测试的服务器,它工作正常。

Whats strange is, the Session is kept when the page is first loaded. But on postback, it loses its variables. Also, this is something that JUST started happening. I've been working on this code for a month or so and it's been working fine. When I deploy this exact code to our dev or test server, it works fine.

我在卡西尼调试此。帮助将不胜AP preciated,谢谢!

I'm debugging this in Cassini. Help would be greatly appreciated, thanks!

沙赫扎德乔杜里

推荐答案

我想通了,这是一个愚蠢的错误。这种变化是发生在Global.asax的Application_Error方法。出于某种原因,当我把一个断点不会打。

I figured it out, it was a stupid mistake. The change was happening in the Global.asax Application_Error method. For some reason when I put a breakpoint there it wouldn't hit.

这篇关于会话清除调试ASP.NET时结束,但开发和测试服务器上正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆