How to view all the content in my IsolatedStorageFile by setting a new page in your browser?
Thank you
I'm not sure what "setting a new page in your browser" has to do with it. I assume you are refering perhaps to the loading of a different Silverlight app from the site.
There are two Isolated Stores one per application and one per site. If you do mean moving from one app to another then you will only be able to share the site store between them.
You can get access to the site store with IsolatedStorageFile.GetUserStoreForSite().
Enumeration of Directories and Files in the store are preformed with the methods GetDirectories() and GetFiles(). Try having a read through the documentation here.
Related
Is it possible to have the same Silverlight object host persist in memory as the user traverses our site? I'm interested in having my Silverlight objects stick around from page to page.
Using IE7.
In short: No.
Typically to achieve this you make the decision that the Silverlight application is your site (or at least a complete segment of your site) and use Silverlight Navigation framework to allow the user to navigate from "page to page" within the application. Where "page" refers to various Xaml pages within a single Silverlight application.
As a workaround, you could store the object in JSON or XML in the IsolatedStorage for the Site (not the application) and use the built in serialization methods to work with the object. Then just check for its existence for each app that is loaded.
I have just created a new silverlight app using Silverlight navigation template. All went well and its working :-)
But the url has an extension of aspx ... can we not remove like asp.net MVC has done?
SilverlightApplication1TestPage.aspx
The next thing that i found strange is how it appends the page name, it uses # symbol like so
SilverlightApplication1TestPage.aspx#Home
I thought it would be more natural to do this (also like asp.net mvc does)
SilverlightApplication1TestPage/Home
SilverlightApplication1TestPage/About
Is there a kind of work around or updated tamplete of some kind
Or its not possible?
Thanks
I'm using Silverlight with Asp.Net MVC and here is a sample URL: http://localhost:37920/#/AdvancedSearch. When I was using straight Asp.Net then yeah I had .aspx files in it. It Still isn't what you really want but gets you closer maybe.
The bottom line is: no. To simplify it everything in a URL prior to the # belongs to the server and everything after the # belongs to the client.
A Silverlight application exists entirely with with in a single URL (page) from the servers perspective. When you use the Silverlight navigation framework you are moving about within the app inside this single HTML page.
If the # is removed there would be fetches made to the server and the results would replace the existing page, the current SL app will be unloaded to be replaced with the resulting content. Even if that resulting content is the same SL app but directed to a different context it would still unload the app and reload it.
The use # is merely a means for navigation within the Silverlight app to be tracked within the browsers navigation history. The browsers own back button will then operate in a way that doesn't surprise the user.
THanks everyone for comments, it got me thinking... and i think i have fixed it.. and found a solutions using asp.net 4.0 routing...
Add a global file to the asp.net project and then add this to application start
// Code that runs on application startup
RouteTable.Routes.MapPageRoute("SilverlightRoute",
"MyApp",
"~/SilverlightApplication1TestPage.aspx");
What is the best way to manage links in a Silverlight application? In my app, I have various custom controls that will open a new website in a new window.
I know in the hosting aspx page you can pass in parameters but I don't know how and where to store these links internally? Should I add a collection to the App object? Is there another mechanism that already exists? Is it a good idea to make my custom controls take the links from a global scope object or the links should be passed in the constructor?
How do you do it?
You have lots of options in Silverlight depending on what type of links they are, how many and how you want to maintain them.
If they are referenced by ID and updated occasionally, you could store them in a resource dictionary or a custom XAML file and load that on demand (XAML files are just object descriptions after all).
If you need to constantly maintain them, a database on the server would store them centrally and you would fetch them as needed via a service.
For lots in individual custom controls, that don't change links often, you could just make the hyperlink URL a property of the object and set the links in the XAML that contains the controls (this is the simplest option for the simplest usage). e.g.
<customControl Hyperlink="http://mylink.com/path/params/etc"/>
Basically it comes down to how you want to manage them. If you drop us a line via our website contact page with specific details we will be happy to provide more detailed examples/suggestions.
Hope this helps.
I want to save user name and password in a cookie.mine is a win forms application.Please advice how can we do this.
Thanks
In win Forms you should use registry,files,databases.... not cookies, cookies for web applications that usually be displayed in web browsers.
I would suggest using a password protected SQLite database (see System.Data.SQLite) and storing whatever you want there.
Also, do remember to hash your passwords!
This is not supposed to be an answers - more of a comment. Apologies if I posted it in the wrong way:
I expect the person asking the question may be aware that this is not the optimal way to store info in a winforms app. I would also like to know how to do this as a possible way of passing information from a website to a desktop app? For example you want the same app to do different things depending on information pass to the app from the website.
I've found that you can Retrieve Query String Information in a ClickOnce Application (http://msdn.microsoft.com/en-us/library/ms172242.aspx) which allows you to pass information from a site to an app. I want to know if cookies could also be used to do this.
I suspect it would be difficult and not practical in many situations to read info from a cookie in this way. One way I can think of doing this is putting a GUID in a cookie and also hardcoing that GUID into the app and running a find in files over the computer to find it. I realise that's a very ugly method but I would like to know what's possible.
I suppose another way might be to embeded a Webbrowser control in a winforms app and get the Webbrowser control to load a page containing JavaScript which reads that cookie. You would then need some way of passing that back to the .NET code though?
First, we can't use Cookies in WinForm applications.. it's a Web side functionality, but you can do something else..
For instance, once I had to do the same thing... to save the latest user connected to the application. I did it with a database (I prefere database, because txt files are not that safe.. we can erase them by mistake..)
So I suggest to save the username (and password in your case) on the database after every Connection event.
Hope that was usefull.
I have a news letter which i did in silverlight, is there a way to send it in email. like as you include html tags, is there a way to include silverlight xap package in it.
Probably better to reference a webpage containing your silverlight content.
Technically, you could put the path to the .xap hosted on a website into an HTML email body, but nearly all mail clients will not display this - most even prevent images from loading by default.
Most email systems will prevent you from embedding active content like SilverLight, as it presents a security risk. Your only option probably is to put your SilverLight app on the web, and just email a link to it.
Don't if you want your newsletter to be read by anyone. See this article for a good list of do's and don'ts when sending emails.
Don't listen to those guys, they're probably FlashHeads... ;)
Besides that they give up too easily. More power to ya!
I assume this newsletter is for an audence that specifically desires your content: i.e a club or similar organization that doesn't have a windows based webserver.
What you do is attach the file in such a way that they drag a zip containing the files that would normally be served from a website to the hard drive - right click - extract all then they run it by clicking on an HTML file with .htm extension that hosts the silverlight plugin instead of an aspx file.
One note that probably won't matter to you is that without a server backing this up the content can't really send you back any info but it CAN get dynamic info that comes from say RSS feeds or WCF services hosted on the web.