Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# httpc中的会话等价物#_C#_Java_Asp.net_Session State_Httpsession - Fatal编程技术网

C# httpc中的会话等价物#

C# httpc中的会话等价物#,c#,java,asp.net,session-state,httpsession,C#,Java,Asp.net,Session State,Httpsession,下面是在控制器中用JAVA编写的代码。我将cart对象保存在HttpSession中,这样我就可以在同一个会话中检索它。在C#中有没有类似的方法 使用属性 要保存: Session["cart"] = cart; 要检索: Cart cart = Session["cart"] as Cart; if(cart != null) { //found } 请参阅:使用属性 要保存: Session["cart"] = cart; 要检索: Cart cart = Session["ca

下面是在控制器中用JAVA编写的代码。我将cart对象保存在HttpSession中,这样我就可以在同一个会话中检索它。在C#中有没有类似的方法

使用属性

要保存:

Session["cart"] = cart;
要检索:

Cart cart = Session["cart"] as Cart;
if(cart != null)
{
   //found
}
请参阅:

使用属性

要保存:

Session["cart"] = cart;
要检索:

Cart cart = Session["cart"] as Cart;
if(cart != null)
{
   //found
}
见: