0

可能吗?那怎么办?

var client = new RestClient("http://localhost:58746");
var request = new RestRequest("Users/Login", Method.POST);
request.AddParameter("UserName", "user");
request.AddParameter("Password", "12345");
request.AddParameter("RememberMe", true);
request.AddParameter("ReturnUrl", "http://localhost:58746");

if (response.StatusCode == HttpStatusCode.OK)
{
  var cookie = response.Cookies.FirstOrDefault(x => x.Name == FormsAuthentication.FormsCookieName); // yeah but that will not get the cookie.
}

如何到达那个cookie?

4

1 回答 1

1

我能够让它以这种方式工作:

var cookie = response.Cookies.FirstOrDefault(x => x.Name == FormsAuthentication.FormsCookieName);

于 2012-11-19T15:24:58.750 回答