serialization - How to Serialize CookieContainer in wp7 applications? -


i tried serialize cookie save , deserialize @ next time start application.but result of deserialize empty.what's wrong?

void savecookie() {     var appstorage = isolatedstoragefile.getuserstoreforapplication();     if (this.checkbox_save_passowrd.ischecked == true)     {         cookiecontainer cc = sec_services.httprequest.cookie;         string filename = "usercookie.xml";         using (var file = appstorage.openfile(filename, system.io.filemode.openorcreate, system.io.fileaccess.write))         {             using (var writer = new streamwriter(file))             {                 system.xml.serialization.xmlserializer xs = new system.xml.serialization.xmlserializer(typeof(cookiecontainer));                 xs.serialize(writer, cc);                 writer.close();             }         }     }     else {         if (appstorage.fileexists("usercookie.xml"))         {             appstorage.deletefile("usercookie.xml");         }     } }  void readcookie() {     var appstorage = isolatedstoragefile.getuserstoreforapplication();     if (appstorage.fileexists("usercookie.xml"))     {         using (system.io.streamreader reader = new streamreader(appstorage.openfile("usercookie.xml", filemode.open)))         {             system.xml.serialization.xmlserializer xs = new system.xml.serialization.xmlserializer(typeof(cookiecontainer));             cookiecontainer obj = (cookiecontainer)xs.deserialize(reader);             reader.close();             sec_services.httprequest.cookie = obj;             if (obj.count != 0) {                 navigationservice.navigate(new uri("/panoramapage.xaml", urikind.relative));             }         }     } } 

i found simple c#: writing cookiecontainer disk , loading in use shows cookiecontainer serialize.but there no soapformatter in wp7 library

isolatedstoragesettings.applicationsettings["index"] = yourcookie; 

so don't need serialize it.

i'm using in project


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -