Question

I need to step back on this one and start over... I want to load values in a comboBox through my ViewModel based on the User logged in. I'm using FA is this the best method? Can I access the cookie directly from the ViewModel?

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");
Was it helpful?

Solution

The answer is easy enough. Just place a reference to

string[] cookies = System.Windows.Browser.HtmlPage.Document.Cookies.Split(';');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top