Silverlight File download from client - c#

I have a Silverlight application that implements some basic CRUD operations on a fairly flat data set. The application loads all the data onto the client to allow for quick editing (this is a fairly small data set no more that a couple K). I would like to allow them to download the file as a CSV so they can edit the data locally.
I know i can set up a HyperLink button to a URL on my webserver and then server the data dynamically using a custom server handler. But this seems kind of roundabout to me because the all the data is already all on the Client's machine (because the Silverlight application loaded it).
So i was wondering if there was a way to prompt the user for a file download and then dynamically generate the file download stream from Silverlight?

You should look at the SaveFileDialog. It allows you to prompt the user to pick a spot to save the file, and then you have access to the file through the SaveFileDialog.OpenFile method.

Related

Best method to upload and retrieve files from/to server from/to Android (client side) - Xamarin

I have a web service (WCF) that gets data from the SQL Server. Is using web service more efficient than directly interacting from Android application to the server (where the folder of the files will be uploaded and retrieved). There are parts of my app which needs to get data from SQL Server database but this one doesn't need it, just for accessing that particular folder in the server.
Is there a tutorial in Xamarin which would guide me how to do it? The file types include PNG, JPEG, EXCEL, PPT, and PDF. I found this but is in iOS platform, Download a File. This one using web service, image uploading from android application to server using c# web service and this using async, download and view a PDF file.
Am I correct that before uploading it to server, it'll need to be converted to byte array? And for viewing the files from the server to Android app, is there a way to automatically display (if there is an image) it to the app and if it's EXCEL, PPT, and PDF, will show up as a link on the app and when click will ask the user to find an app to view the following file type.
I am absolutely new to this so I'd greatly appreciate any suggestion.

SaveDialog in Flex passes FileName and Path to Server Side C#

So I've got a flex project that runs on the desktop. I've also got server side C# code that I run to export some data into a PDF when ever I click a button on the flex application. Currently I just auto save the files to the temp folder inside of the C:\ directory, but I was wondering how I would go about opening up a Save File dialog box in Flex so I can select a location and name for my file and then pass the full file path string over to the server to do the exporting. My research brought me to a "Filereference" class in Flex, however it looks like that actually saves some sort of file, where all I want to do is get the chosen file path from it.
EDIT: I'm working with a project that has both an Adobe AIR Application side and a Web Application side, both being run by common code, so it'd be best to have a method that is supported by both.
Since you said you're building a Desktop application, I assume you are using Adobe AIR. You can use the File.browseForDirectory() method.

Creating a stub for editing office documents

I'm looking to create a synchronization mechanism for a document storage service.
The essential idea is that the user downloads a stub file say somefile.stub that contains a link to the file on the server.
When the stub file is clicked on an app on the users machine (associated with .stub) opens up looks in the file and downloads the document from the server in the background.
Once I've got the file locally I'd like to get windows to open up the file in the appropriate editor e.g. word. I really don't want to have to save out the file and then open word or whatever via Process and a command line.
Also, I'd like to be able to grab the document when its saved and send it back to the server to keep everything in synch.
I'd prefer to write the client application in c# if possible.
You have to create a service running continuosly on the client machine, that should orchestrate the stub file transfer and the opening of them. Opening with the proper program can be achieved by using Process with StartInfo.UseShellExecute = true;. You can also use a FileSystemWhatcher to be notified when the external app modify the file.
Here is one solution:
Create a Class 2 WebDAV Server and publish your MS Office documents via it.
In case you target MS Office 2013 you can use the following link to open documents for editing directly from your WebDAV server:
ms-word:ofe|u|http://mywebdavserver.com/path/document.docx
This will eliminate download/upload steps and will work in the SharePoint-like manner. You also do not need to deploy any client application in this case.

open a file before uploading through file uploader in asp.net

I want to upload an exe to web server from client system through file up-loader and want to run/open that exe before uploading .how can i run/open that exe before uploading it.
Short answer: No way!
If you really want to execute it client side, the user has to do it manually, JavaScript and jQuery are not going to execute an application locally.
if you want to execute it on the server side, you should first upload it to the server.
why are you trying to do this? can you explain a bit your use case?
If you're trying to execute on the server then you'll have to upload it first. Plain and simple.
You cannot make the web client open a file or even access the files because of browser security restrictions. All you can do is access the immediate file name (e.g., file.ext) and file content once the user browses, manually selects the file, and the form submits.
The reason for this restriction is that, if a website could execute files, any site could very easily install malware on a person's machine.
On the other hand, to execute the EXE on the server, it must first be uploaded.

sync database to uploaded file using Windows Service or website code

I have a website that occasionally needs to have a handful of the tables in its database updated. The updates come from another system that exports to comma delimited text files. I can then either FTP the text files to the web server, send them in through an admin upload page, or manually log in to Remote Desktop to download the text files. I have all my C# code written to parse the files, check the database contents, and decide what to do.
Should I code the sync logic to be part of a file upload page, protected in the admin section of the site or should I create a Windows Service that constantly looks for files to process in a particular directory that I can drop files in through FTP?
I have used Windows Services in the past and they have worked great, but if I ever have to make a change to the code it can take longer than it would if I just had to modify an ASPX.
Are their security benefits one way or another?
Performance benefits?
ASPX page wins the "ease of maintenance" category.
I would create a Windows Service to watch a secure folder and use a directory watcher to look for new files. Since the files are coming from another system, it is asynchronous in nature, and it is much more performant to have a Windows Service running separately to watch for updates as they happen. It can also parse the files and update the database for you.
Depending on who maintains the remote system, the easiest way is to grant permission to the service to access the files on a secure, shared folder. Then you won't need to do anything manually.

Categories

Resources