Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.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
&引用;Request.Cookies(“iduser”)。“价值”;等价于C#_C#_Asp.net - Fatal编程技术网

&引用;Request.Cookies(“iduser”)。“价值”;等价于C#

&引用;Request.Cookies(“iduser”)。“价值”;等价于C#,c#,asp.net,C#,Asp.net,我在VB.net中有一个应用程序,我正在C#(ASP.net 4)中做一个新的应用程序。用户只有一个用户名可以在两个应用程序中登录 关键是。。。我怎样才能得到cookie的C值 这就是我在VB中得到它的方式 IdUser = Request.Cookies("iduser").value Thks字符串IdUser=Request.Cookies[“IdUser”].Value这是什么类型的应用程序 我想是ASP.NET吧 Request.Cookies["iduser"].Value 我认

我在VB.net中有一个应用程序,我正在C#(ASP.net 4)中做一个新的应用程序。用户只有一个用户名可以在两个应用程序中登录

关键是。。。我怎样才能得到cookie的C值

这就是我在VB中得到它的方式

IdUser = Request.Cookies("iduser").value

Thks

字符串IdUser=Request.Cookies[“IdUser”].Value

这是什么类型的应用程序

我想是ASP.NET吧

Request.Cookies["iduser"].Value
我认为你可以做到:

HttpCookie cookie = Request.Cookies["iduser"];
或者正如其他人所说:

string cookie = Request.Cookies["iduser"].Value;
根据您希望如何管理cookie,您可以使用其中任何一种。 试试这个:

var str = System.Web.HttpContext.Current.Request.Cookies["iduser"].value;

@蒂亚戈:你说的组装是什么意思?对不起…组装引用。比如…“使用System.Collections.Generic”System.Web命名空间应该是您所需要的全部。这段代码的上下文是什么?我以为它在ASP.NET页面上。如果它在别处,您可能需要执行HttpContext.Current.Request.Cookies。。。