在另一个网页无法使用ASP.Net会话状态 [英] ASP.Net session state not available on another webpage

查看:88
本文介绍了在另一个网页无法使用ASP.Net会话状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计与Default.aspx的所有动作发生在一个页面的Web应用程序。我存储用户的用户ID在Session中,他登录后。我使用的SWFUpload Default.aspx中上传文件到upload.aspx。
当upload.aspx接收文件时,它会检查HttpContext.Current.Session为用户的ID。这用来工作,但由于最近HttpContext.Current.Session没有对我的会话的任何值。我一定改变沿线的东西,但我不知道。

I'm designing a single page web application with all the action happening on default.aspx. I store the user's user id in Session after he logs on. I use SWFUpload in default.aspx to upload files to upload.aspx. When upload.aspx receives a file, it checks HttpContext.Current.Session for the user's id. This used to work, but since recently HttpContext.Current.Session doesn't have any values regarding my session. I must have changed something along the line but I have no idea what.

更奇怪的是,它仍然与IE浏览器的工作原理,但不能与任何Firefox或Chrome。我也看了一些关于Flash在Firefox错误上传IE的会话cookie(我意译)。

Stranger still, it still works with IE, but not with either Firefox or Chrome. I also read something about Flash in Firefox mistakenly uploading IE's session cookie (I'm paraphrasing).

我如何检索上传页面(Firefox和Chrome)?会话数据

How do I retrieve the Session data from the upload page (Firefox and Chrome)?

推荐答案

这是与Flash和非IE浏览器的cookie中的已知问题。这里有一个在swfupload.org ,讨论解决办法,并的只是code在以上 snipplr。基本上Flash不发送的cookie(或发送IE的cookie)在Firefox和Chrome等,这样你的SessionID不与这些浏览器的upload.aspx请求一起发送。在IE中它会工作,虽然。

This is a known issue with Flash and cookies on non-IE browsers. Here's a post over at swfupload.org that discusses a workaround, and 'just the code' over at snipplr. Basically Flash does not send your cookies (or sends IE cookies) on Firefox and Chrome, etc., so your SessionID is not sent with your upload.aspx request in those browsers. In IE it will work, though.

上面的解决方法是发送的SessionID和验证票后或URL,然后在Global.asax拦截请求并重新创建正确的饼干ASP.NET寻找他们为了获取认证或会话信息之前,

The workaround above is to send the SessionID and Authentication ticket in the post or url, and then in the Global.asax intercept the request and recreate the correct cookies before ASP.NET looks for them in order to retrieve authentication or session information.

这篇关于在另一个网页无法使用ASP.Net会话状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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