Click here to Skip to main content
15,881,281 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: How to modify DataTemplate programmatically? Pin
Mark Salsbery16-May-11 3:04
Mark Salsbery16-May-11 3:04 
AnswerRe: How to modify DataTemplate programmatically? Pin
SledgeHammer0116-May-11 6:21
SledgeHammer0116-May-11 6:21 
GeneralRe: How to modify DataTemplate programmatically? Pin
Tesic Goran17-May-11 1:24
professionalTesic Goran17-May-11 1:24 
GeneralRe: How to modify DataTemplate programmatically? Pin
Pete O'Hanlon17-May-11 1:54
mvePete O'Hanlon17-May-11 1:54 
Questionobjects added to an IDictionary must have a Key attribute [modified] Pin
Lutosław15-May-11 23:20
Lutosław15-May-11 23:20 
NewsRe: objects added to an IDictionary must have a Key attribute Pin
Lutosław16-May-11 0:05
Lutosław16-May-11 0:05 
AnswerRe: objects added to an IDictionary must have a Key attribute Pin
Venkatesh Mookkan16-May-11 0:41
Venkatesh Mookkan16-May-11 0:41 
AnswerRe: objects added to an IDictionary must have a Key attribute Pin
markovl16-May-11 0:53
markovl16-May-11 0:53 
AnswerRe: objects added to an IDictionary must have a Key attribute Pin
Venkatesh Mookkan16-May-11 0:58
Venkatesh Mookkan16-May-11 0:58 
GeneralRe: objects added to an IDictionary must have a Key attribute Pin
Lutosław16-May-11 1:17
Lutosław16-May-11 1:17 
QuestionPayment Gateway in Silverlight [modified] Pin
Vimalsoft(Pty) Ltd15-May-11 1:59
professionalVimalsoft(Pty) Ltd15-May-11 1:59 
AnswerRe: Payment Gateway in Silverlight Pin
BobJanova16-May-11 22:45
BobJanova16-May-11 22:45 
QuestionControl Template not applied Pin
Lutosław14-May-11 10:11
Lutosław14-May-11 10:11 
AnswerRe: Control Template not applied Pin
SledgeHammer0114-May-11 10:59
SledgeHammer0114-May-11 10:59 
GeneralRe: Control Template not applied Pin
Lutosław14-May-11 11:53
Lutosław14-May-11 11:53 
NewsRe: Control Template not applied Pin
Lutosław14-May-11 13:12
Lutosław14-May-11 13:12 
GeneralRe: Control Template not applied [modified] Pin
Mark Salsbery14-May-11 13:21
Mark Salsbery14-May-11 13:21 
GeneralRe: Control Template not applied Pin
Lutosław14-May-11 14:29
Lutosław14-May-11 14:29 
QuestionObject looses a Cookie Value in Silverlight Pin
Vimalsoft(Pty) Ltd14-May-11 5:12
professionalVimalsoft(Pty) Ltd14-May-11 5:12 
QuestionRe: Object looses a Cookie Value in Silverlight Pin
Mark Salsbery14-May-11 7:21
Mark Salsbery14-May-11 7:21 
AnswerRe: Object looses a Cookie Value in Silverlight Pin
Vimalsoft(Pty) Ltd14-May-11 7:31
professionalVimalsoft(Pty) Ltd14-May-11 7:31 
AnswerRe: Object looses a Cookie Value in Silverlight Pin
Abhinav S15-May-11 5:29
Abhinav S15-May-11 5:29 
GeneralRe: Object looses a Cookie Value in Silverlight Pin
Vimalsoft(Pty) Ltd15-May-11 5:35
professionalVimalsoft(Pty) Ltd15-May-11 5:35 
Good Day Abhinav

this is the exact code i use. The Problem is not in storing and retrieving of the cookie, but it lies in transporting it from the Silverlight to a service.when i pass it to a service method, on the way the value get lost. This code was working for days, after i formated my machine the same thing does not work anymore.


This is my generic functions i use to deal with cookies and when i debug i can see the value be retrieved from a cookie and being passed to a wcf method.


public static void DeleteCookie(string key)
       {
           //string oldCookie = HtmlPage.Document.GetProperty("cookie") as String;
           DateTime expiration = DateTime.UtcNow - TimeSpan.FromDays(1);
           string cookie = String.Format("{0}=;expires={1}", key, expiration.ToString("R"));
           HtmlPage.Document.SetProperty("cookie", cookie);
       }


public static void SetCookie(string key, string value)
       {

          // string oldCookie = HtmlPage.Document.GetProperty("cookie") as String;
           DateTime expiration = DateTime.UtcNow + TimeSpan.FromDays(2000);
           string cookie = String.Format("{0}={1};expires={2}", key, value, expiration.ToString("R"));
           HtmlPage.Document.SetProperty("cookie", cookie);
       }

/// 
        /// Retrieves an existing cookie
        /// 
        /// cookie key
        /// null if the cookie does not exist, otherwise the cookie value
        public static string GetCookie(string key)
        {
            string[] cookies = HtmlPage.Document.Cookies.Split(';');
            key += '=';
            foreach (string cookie in cookies)
            {
                string cookieStr = cookie.Trim();
                if (cookieStr.StartsWith(key, StringComparison.OrdinalIgnoreCase))
                {
                    string[] vals = cookieStr.Split('=');

                    if (vals.Length >= 2)
                    {
                        return vals[1];
                    }

                    return string.Empty;
                }
            }

            return null;
        }


Thanks
Vuyiswa Maseko,

Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

QuestionMVVM Model Pin
Member 455049313-May-11 1:34
Member 455049313-May-11 1:34 
AnswerRe: MVVM Model Pin
Nicolai Schrade13-May-11 4:04
Nicolai Schrade13-May-11 4:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.