Reading cookie in c#

后端 未结 7 1019
心在旅途
心在旅途 2020-12-19 07:47

I want someone who visits my internationalized site to be able to change the language. I thought best way would be to store the language chosen in a cookie - so when the pag

7条回答
  •  爱一瞬间的悲伤
    2020-12-19 08:30

    Can you try this?

    HttpCookie aCookie = Request.Cookies["UserSettings"];
    string lang = Server.HtmlEncode(aCookie.Value);
    

    http://msdn.microsoft.com/en-us/library/ms178194.aspx

    EDIT Does this help you? asp.net mvc can't access cookie data in base controller

提交回复
热议问题