访问页面会话ASP [英] Access page session ASP

查看:70
本文介绍了访问页面会话ASP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个FacebookConnect 包装器.我想在会话中存储内容.我有一个static 类,用于存储我的所有方法.我需要存储会话的访问令牌.我通过使用HttpContext 作为参数传递的方法将其添加到会话中来实现.

I am creating a FacebookConnect wrapper. I want to store stuff in the session. I have a static class that is storing all my methods. I need to store the access token for the session. I do this by adding it to the session with a method where the HttpContext is passed through as a parameter. Is there some way to do this without passing it through as a parameter every time the user wants to call the method?

推荐答案

因为您的类是静态的,所以它存在于所有会话,因此它需要当前会​​话中有状态的内容.因此,我认为答案是否定的,您需要始终访问上下文,尽管,我确实相信其他人已为您提供了答案,但这只是一种评论.您不必传递它,可以使用HttpContext.Current.Session,前提是您已经在使用System.Web来访问它.
Because your class is static, it exists across all sessions, therefore it needs something stateful from the current session. Therefore, I think the answer is no, you need to always access the context, although, I do believe someone else has given you an answer, but as a comment. You don''t have to pass it in, you can use HttpContext.Current.Session, assuming you''re already using System.Web to access it.


这篇关于访问页面会话ASP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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