简体   繁体   English

如何在ServiceStack中获取Cookie

[英]How to get cookie in ServiceStack

I have been trying to read a cookie in servicestack but get 我一直在尝试在服务堆栈中读取Cookie,但得到

"The type 'Cookie' is defined in an assembly that is not referenced. You must add a reference to assembly ..." “类型'Cookie'是在未引用的程序集中定义的。您必须添加对程序集的引用...”

I have alredy added the System.Web reference! 我已经添加了System.Web参考! But still get same error. 但是仍然出现相同的错误。 So if i am in wrong way what is the way to read cookie in ServiceStack ? 因此,如果我的方式有误,在ServiceStack中读取cookie的方式是什么?

 public class SocialAccountService : ServiceStack.Service
    {
        private static readonly ILog logger = LogManager.GetLogger(typeof(SocialAccountService));
        public SocialAccountService()
        {

        }
        public object Any(SocialAccount req_account)
        {
            var cookie = base.Request.Cookies[""];
            ControllerAuthorizationProxy<SocialAccount>.Any(new SocialAccountController(req_account), this);
            return null;
        }

    }

ServiceStack, Version=4.0.0.0 ServiceStack,版本= 4.0.0.0

Visual Studio says you need to add a reference to System.Net . Visual Studio说您需要添加对System.Net的引用。 I guess your "..." say the same. 我猜你的“ ...”是一样的。

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

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