Retrieving file path from IsolatedStorage

Posted Sat, Oct 4 2008 12:57 by AngelHernandez

Some days ago I was working on a new article and I needed to retrieve a file embedded in my assembly, I usually extract it into the TEMP folder but before publishing anything (code) I test it on virtual machines and it failed on Windows Server 2008  Sad  but after investigating the cause I finally found the problem... Permissions.  Anyways, I wrote a method which returns the path of a file in the IsolatedStorage so we can reference it anywhere in our application.

Regards,

Angel

Comments

# re: Retrieving file path from IsolatedStorage

Tuesday, November 11, 2008 7:22 PM by Richard

Me funciono para XP, pero en Windows Vista no...

no tienes alguna solucion para ese problema?

Gracias

# re: Retrieving file path from IsolatedStorage

Wednesday, November 12, 2008 1:37 PM by Lucho

Excellent post!, I wasn't able to find that info anywhere else.

Thanks!

# re: Retrieving file path from IsolatedStorage

Thursday, November 20, 2008 7:21 PM by Merill Fernando

Hey dude,

This is exactly what I was looking for and you came in fourth on my google search.

But what's the use of an image to me :(

Post the text man.

# re: Retrieving file path from IsolatedStorage

Thursday, March 26, 2009 11:12 AM by Irena

Excellent point, except the screenshot is barely readable.  Here's the crux of the matter:

isoStore.GetType.GetField("m_RootDir",Reflection.BindingFlags.NonPublic or Reflection.BindingFlags.Instance).GetValue(isoStore).ToString

Returns full path to isolated storage file, which might be something like this:

"C:\Documents and Settings\username\Local Settings\Application Data\IsolatedStorage\oynrourp.ln0\fvz10mse.2u0"\Url.z3rfwf2icgvihhnwhmaupbbmbwnkhlwf\AssemFiles\"

# re: Retrieving file path from IsolatedStorage

Thursday, June 11, 2009 1:29 PM by Gabe

This just saved me today. CrystalReports Load method absolutely must take a filepath and this was giving me some trouble. Thanks for this great post!

# re: Retrieving file path from IsolatedStorage

Friday, December 18, 2009 2:39 PM by Pawan Venugopal

Hi Angel,

  Thanks for the great Post. I am currently having some problem getting the file from Isolated Storage. I have a asx file which is stored in isolated storage. I would like to pass the location of the file as the source to Media element. Can you help me determine how to achive this.

This is the source code for storing my file in isolated storage.

               using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())

               {

                   using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("Playlist.asx", FileMode.Create, isoStore))

                   {

                       XmlWriterSettings settings = new XmlWriterSettings();

                       settings.Indent = true;

                       settings.OmitXmlDeclaration = true;

                       using (XmlWriter writer = XmlWriter.Create(isoStream, settings))

                       {

                           writer.WriteStartElement("asx");

                           foreach (YouTubeInfo entry in entries)

                           {

                               XElement xe = new XElement("entry",

                                                   new XElement("title", entry.Title),

                                                   new XElement("Thumbnail", entry.ThumbnailUrl),

                                                   new XElement("ref",

                                                   new XAttribute("href", entry.LinkUrl)));

                               xe.WriteTo(writer);

                               youtubeCollection.Add(entry.ThumbnailUrl);

                           }

                           writer.WriteEndElement();

                           writer.Flush();

                           writer.Close();

                           isoStream.Close();

                       //this.coverFlow.ItemsSource = youtubeCollection;      

                       }

                   }

# re: Retrieving file path from IsolatedStorage

Thursday, February 04, 2010 12:51 PM by Haab

Hey Angel,

Thank you for the post...but codes are shown partially. Could you please post it again

Haab

# re: Retrieving file path from IsolatedStorage

Tuesday, March 02, 2010 8:33 AM by IJeb Reitsma

If you save the image and open the saved image you will see all the text.

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: