0

我需要退后一步并重新开始...我想根据登录的用户通过我的 ViewModel 在组合框中加载值。我正在使用 FA 这是最好的方法吗?我可以直接从 ViewModel 访问 cookie 吗?

FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
user,
DateTime.Now,
DateTime.Now.AddDays(30),
false,
"Role One",
FormsAuthentication.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);

// Create the cookie.
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName,
encTicket));
// Show the Silverlight control
Response.Redirect("Default.aspx");
4

1 回答 1

0

答案很简单。只需参考

string[] cookies = System.Windows.Browser.HtmlPage.Document.Cookies.Split(';');
于 2013-02-26T04:25:17.227 回答