asp.net mvc - Http cookie not added to collection -


maybe doing wrong, after adding cookies this.response cookie collection in mvc:

   httpcookie cookierefreshtoken = new httpcookie("refreshtoken");    cookierefreshtoken.value = string.format("{0}", refreshtoken);    cookierefreshtoken.expires = new datetime(2017, 12, 01);    response.cookies.add(cookierefreshtoken); 

when try access cookies in different action - there no cookies :

var cookie = request.cookies.get("refreshtoken").value; 

where request of type httprequestbase , response of type httpresponsebase

am wrong somewhere?

try :

   httpcookie cookierefreshtoken = new httpcookie("refreshtoken");    cookierefreshtoken.value = string.format("{0}", refreshtoken);    cookierefreshtoken.expires = new datetime(2017, 12, 01);     httpcontext.current.response.cookies.add(cookierefreshtoken);   var cookies= httpcontext.current.request.cookies["refreshtoken"];  string values = cookies.value; 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -