public ActionResult LogIn(FormCollection collection) { ProfileServiceClient client = new ProfileServiceClient(); var username = collection["username"]; var password = collection["password"]; Profile profile = new Profile(); profile.Username = username; profile.Password = password; var profileId = client.Authenticate(profile); ViewBag.LoginStatus = profileId; var cookie = new HttpCookie("aCookie"); cookie.Value = profileId.ToString(); //var cookieValue = Request.Cookies.Get("aCookie").Value; Response.Cookies.Add(cookie); return(Redirect("/Chat/GetChats")); }