How to get the cookie value in asp.net website

后端 未结 4 1688
渐次进展
渐次进展 2020-12-23 13:56

I am creating a cookie and storing the value of username after succesfull login. How can I access the cookie when the website is opened. If the cookie exist I want to fill t

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 14:28

    You may use Request.Cookies collection to read the cookies.

    if(Request.Cookies["key"]!=null)
    {
       var value=Request.Cookies["key"].Value;
    }
    

提交回复
热议问题