Search code examples
silverlighthttphandlersavefiledialogihttphandler

save file in Silverlight without showing Save as dialog


Is it possible to save a file to the users local Downloads folder without prompting them with a save as dialog?

I have an application where a user right mouse clicks to choose an option to save a specific file.

I have used IHttpHandler interface but not sure how to call this handler in code so that the system will start saving to the downloads file without the user having to navigate to a different page


Solution

  • One way out is to host the required file on a public URL and simply navigate to that URL in a new tab/window from your silverlight app..

    HtmlPage.Window.Navigate(new Uri("<YOUR FILE's URL>"), "_blank");
    

    This should cause the browser to open that link in a new tab and in turn download it automatically (occasionally depending on the user settings)..