简体   繁体   English

从ASP.NET MVC和C#中的容器检索cookie

[英]Retrieving cookie from a Container in ASP.NET MVC and C#

//Controller code
CookieContainer cookieContainer = new CookieContainer();
//makes new cookie here
cookieContainer.Add(myCookie);


//Service/Facade code
//myCookie gets passed here

How do I pull the cookie out of the container to make sure it's the right cookie? 如何从容器中取出Cookie,以确保它是正确的Cookie?

Assuming you trying to use cookies with web services, check out this Microsoft Support article: 假设您尝试通过Web服务使用cookie,请查看以下Microsoft支持文章:

HOW TO: Use CookieContainer to Maintain a State in Web Services When You Use Visual C# .NET 如何:当您使用Visual C#.NET时,使用CookieContainer维护Web服务中的状态

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM