如何在c#中设置类内部的会话 [英] how to set session inside of class in c#
问题描述
我已经为我的应用程序中的登录操作创建了一个类...
i想在我的班级里面使用session来保存用户ID
我怎么能做这件事
?
你可以在Session中设置你的userId变量如下。
会话[ FirstName] = userId;
看看下面链接了解 Asp.Net Session 的详细信息。
< a href =http://msdn.microsoft.com/en-us/library/ms178581.aspx> http://msdn.microsoft.com/en-us/library/ms178581.aspx
编辑 - 要访问任何课程中的课程,请查看以下链接。
http://stackoverflow.com/questions/621549/how-to-访问会话变量从 - 任何类型-ASP-净
hi ,, i have made a class for login operations in my application ...
i want to use session inside of my class ,, for saving user id
how can i do this thing
?
You can set your userId variable in Session as below.
Session["FirstName"] = userId;
Have a look ate below link for more details on Asp.Net Session.
http://msdn.microsoft.com/en-us/library/ms178581.aspx
Edit - To access Sessions in any class have a look at below link.
http://stackoverflow.com/questions/621549/how-to-access-session-variables-from-any-class-in-asp-net
这篇关于如何在c#中设置类内部的会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!