如何检索和存储user_session,id [英] how to retrieve and store user_session,id

查看:145
本文介绍了如何检索和存储user_session,id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以回答这个问题.


如果要添加产品到addtocart,我想使用C#编码,其中显示了有关使用存储过程存储在db中的pro_id和user_session的信息.

Can Anyone ple answer this.


i want C# coding for if i add product to addtocart in that shows regarding pro_id and user_session stored in db using stored procedure.

推荐答案

您可以使用如下所示的用户会话

Session ["User"] =其他";

//或者您可以使用以下方式唯一地存储用户会话

字符串userId = Session.SessionID;
you can use the user session like follows

Session["User"]="Something";

//or you can use the fllowing to store the user session uniquely

string userId = Session.SessionID;


设置会话:
Set session:
Session["pro_id"] = "1";



检索会话:



Retrieve session:

if(Session["pro_id"] != null)
{
   String pro_id = (String)Session["pro_id"];
}



更多内容:
http://msdn.microsoft.com/en-us/library/ms178581.aspx [ ^ ]



More here:
http://msdn.microsoft.com/en-us/library/ms178581.aspx[^]


这篇关于如何检索和存储user_session,id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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