I have set my cookie in the login section like so: var cookie = new HttpCookie("sys_user_id", (query.UserAccountId).ToString()) { Expires = DateTime.Now.AddDays(1) }; Response.SetCookie(cookie);  I can access and change to integer the same cookie at the view using this code:   but if I put this in a .js file, I get error at @Convert.ToInt32(HttpContext.Current.Request.Cookies["sys_user_id"].Value);. It is because the .js file cannot read the razor syntax. Is there a way to get my "sys_user_id" cookie and convert it to an integer using javascript so I can place it in my .js file?
 For those who have not yet got the answer to this kind of question, this is how I did it. I created a new function like so: function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i