我需要退一步并重新开始......我想根据用户登录,通过我的ViewModel在comboBox中加载值。我使用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");
答案 0 :(得分:0)
答案很简单。只需添加对
的引用string[] cookies = System.Windows.Browser.HtmlPage.Document.Cookies.Split(';');