Hi All,
Please help me out this...............
I am trying to set cookies as a string in silverlight project and reading back in reportpage.aspx which getting opened using html. window.
The issue is : i am able to read the cookies values from aspx page except the expiry date, httpcookie class in aspx page shows expiry date as 001, with this issue my cookie is not getting expired.
let me know if you need any more clarifications.
mainpage.xaml.cs private void Button_Click(object sender, RoutedEventArgs e) { DateTime expireDate = DateTime.Now + TimeSpan.FromHours(2); string newCookie = "UserId =" + 1 + ";expires=" + expireDate.ToString("R"); HtmlPage.Document.SetProperty("cookie", newCookie); Uri serverUri = Application.Current.Host.Source; string folder = (serverUri.LocalPath.Split('/'))[1]; Uri uri = new Uri(string.Concat(serverUri.Scheme, "://", serverUri.Host.ToString(), ":", serverUri.Port.ToString(), "/ReportPage.aspx")); HtmlPage.Window.Navigate(uri, "_blank"); } // report page.aspx protected void Page_Load(object sender, EventArgs e) { HttpCookie ht = Request.Cookies["UserId"]; Label4.Text = ht.Expires.ToString(); Label1.Text = ht.Value; }
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog