Skip to main content
Home Forums Silverlight Programming Visual Studio & Silverlight Development Tools Environment.CurrentDirectory --> is resulting error
16 replies. Latest Post by anil_litam on July 7, 2009.
(0)
anil_litam
Member
558 points
262 Posts
06-27-2009 6:32 PM |
Hi,
i am try to get my silverlight application total path using Environment.CurrentDirectory.
I written this code in xaml.vb file resulting runtime errors.
PLease suggest me what is the problem and solution for this...
ken tucker
All-Star
16288 points
2,485 Posts
06-27-2009 6:53 PM |
You only have access to isolated storage from silverlight 2.
06-29-2009 6:43 AM |
06-29-2009 7:07 AM |
OK. Can you please suggest me how can i get my SL application path using ISOLATED STORAGE
I am using SL3
Thanks...
Tim Dawson
Participant
1130 points
218 Posts
06-29-2009 7:24 AM |
Your application path is a website. You can use the browser interop APIs to get its path or in fact interact with the whole HTML DOM.
06-29-2009 7:28 AM |
For ex: My application path is c:\SLTest\page.xaml
I would like to get the path c:\SLTest
For this i don't want to make any API calls.
Because i am writing the code in XAML page(client page) and also my application is in local drive.
How can i get this path using XAML page code.
06-29-2009 9:12 AM |
Silverlight runs in a sandbox. You do not have access any part of the file system other than the isolated storage. You do not have access to any api calls.
Silverlight 3 has a save file dialog but the user has to select where to save a file no have no control over where the file is saved. The user has to press ok in the dialog or there is no way to save a file with the save file dialog
06-30-2009 1:14 AM |
Please give the basic links to understand about sandbox and
i am not looking for any savefiledialog, but i don't think so getting my local application path is that much difficult. {Because i am not looking for any server access)
Thanks for your suggessions...
06-30-2009 4:19 AM |
Silverlight apps run on the web. There's no API for obtaining a "local" path. Even if you run it locally, you're still running in a browser, client-side. Refer to my previous post for how you can obtain the URL to the page hosting the app.
06-30-2009 6:46 AM |
http://en.wikipedia.org/wiki/Sandbox_(security)
06-30-2009 8:36 AM |
Though i am using SL from past 4 months, still i don't know what is sandbox.
Thanks for the link.
06-30-2009 8:40 AM |
Ok. Thanks for good replys.
So, can you tell me how can i access c:\\test.xml file, without directly adding it onto my application.
As per your reply i think there is no option.
Am i right? OR please suggest me how can i achieve this using Isolated Storage.
Thanks once again...
06-30-2009 9:16 AM |
Correct; there is no way you can access c:\test.xml. The file would have to be in isolated storage or part of the application. Unless Silverlight considers files in the same directory as the application to be part of the site of origin, that is. I don't understand why you're even using Silverlight if you're trying to create a client application.
06-30-2009 9:40 AM |
Thanks for your interest to chase me.
Might i didn't explain clearly.
My SL application is in c:\SLTest directly.
So obviously i can get two folder sunder SLTest folder. They are SLTest and SLTest.Web and also SLTest solution file.
In the root SLTest folder i added one more folder 'MyXml' which is having "First.XML"
My only requirement is i should be access this "First.XML" from my XAML code, with out adding it into my application [solution explorer right click --> add existing item --> select this xml] i don't want this approach to do.
Moreover i am developing a tool not direct application.
Very thanks...
06-30-2009 10:06 AM |
I would add the xml file to the website's clientbin folder. This thread shows how to access the file
http://silverlight.net/forums/p/99312/226675.aspx
06-30-2009 10:22 AM |
Why are you using Silverlight and not WPF?
07-07-2009 12:24 AM |
I am developing a tool, so i can't add xml files to clientbin which are required for end application.
i don't know how many xml files i required once the product over...