简体   繁体   English

如何在C#中通过SessionID获取会话

[英]How do I get a session by SessionID in C#

I'm working on an ASP.NET MVC app and I'm trying to use the 'Uploadify' JQuery plugin. 我正在使用ASP.NET MVC应用程序,并且试图使用“ Uploadify” JQuery插件。 One issue I'm running into is that there is apparently a well known bug in regards to sending up cookie information with Flash (which uploadify utilizes). 我遇到的一个问题是,关于使用Flash发送cookie信息(uploadify会利用它),显然存在一个众所周知的错误。 So I've tried sending the auth token and the session id with my request when uploading a file using uploadify. 因此,在使用uploadify上传文件时,我尝试随请求一起发送身份验证令牌和会话ID。 This is great in that I can figure out if someone is authorized, but I can't seem to get the session and thus do not have access to session variables. 这样做的好处是,我可以确定某人是否被授权,但是我似乎无法获得会话,因此无法访问会话变量。 If I have the SessionID, is there a way to get the Session in C#? 如果我有SessionID,是否有办法在C#中获取Session?

Session["myVar"] = "1234";
<%= this.Session.SessionID %>

HttpContext.Session.SessionID

Note that you can get the session ID, but you need to store things in the temp data or it will keep giving you new IDs. 请注意,您可以获得会话ID,但是您需要将内容存储在临时数据中,否则它将继续为您提供新的ID。

This post has the answer 这个帖子有答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM