website to receive file upload from winform - c#

I need to upload a file from a winform application to a website.
I have the winform side ready to go, I just need a little help with the webform side.
Client.UploadFile("http://xxx.yyy.com/data/", "sample.txt");
The file(s) that are to be uploaded, binary files, just need to be dumped into a subdirectory called data
I am stuck on the web page that will receive the file and save it into the directory.
c# and asp.net please
thank you

You don't need a web page for accepting the file being sent to server. Probably the easiest way would be to set up ftp on server and upload file there.
Sample code from msdn: http://msdn.microsoft.com/en-us/library/ms229715.aspx

Related

Docusign REST API to get document in envelope

I am creating a MVC web application with Docusign REST API.
I am going to create actionlink in index view for each record witch downloads
document in the record's envelope.
I am planning to use call following HTTP request.
GET /v2/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}
When I call this request, I get pop up where I can choose location and name of file for the document that I am downloading.
Is there any way for me to pass folder location and name of file as parameter and download the file without getting this pop up?
I don't think Docusign does not provide such API to download in this way.
Thank you in advance.
A Web Server can not access the client's computer. Imagine if Google (or any other site) could just start programs on your machine when you visit their site! So popup has nothing to do with DocuSign.
So using DS API, you will get pdf as byte[], once you got byte[] then its your code who has to write it to a File and that is not possible on a WEBServer as WebServer will not be able to access the CLient's computer to directly save them on the machine without showing that popup. If you run below code in Standalone Java Application or I think Java Applets can also do it, then you can use FileOutputStream to write byte[] into a file directly in the machine.

Trouble with uploaded files in ASP.NET

I know how I can upload a file (i.e. PDF file) in ASP.NET. How can I do some operation on this file after it had been uploaded?
For example, I need to correct the wrong words, or another application is for some plagiarism system.

Is it possible to store Clickonce application files in SQL server?

I am publishing Windows form application using ClockOnce in ASP.net web application. I understood that when user click on publish button then the clickonce application will be downloaded. this option is unsecure as anyone who know the download URL can download. to add Authentication I am using httphandler as per David P Henry suggestion from codeproject everything is working fine. I would like to add more security to this approach instead of placing the clickOnce app file in Application Files folder in web app I would like to place these files in SQL Server. So my application should able to download these file from SQL Server and send it to user.
Is it possible in Clockonce?
If possible I would like to know the approach.
Yes it is possible. Use a VirtualPathProvider to read the files from SQL instead of the file system.
As ClickOnce requests the files via http/https it is possible to intercept each request and pass your own version (in this case read from SQL instead of the server's file system).
Linked below is a simple project that shows how to utilise a custom VirtualPathProvider.
http://www.codeproject.com/Articles/16848/Creating-Custom-Virtual-Path-Provider-in-ASP-Net-2
I would suggest converting the directory where the files should be stored to an application and adding the Global.asax to the root of the application.
Then add a handler mappings for *.deploy and *.manifest for the root directory so your VirtualPathProvider will run when each file is requested.
Within the overridden FileExists method (in your VirtualPathProvider) write some logic to return if the file exists or not. You could put some authorisation here but I don't know if ClickOnce caches Http responses, as the server would return a 404 if this function returns false.
Within the Stream Open() in your VirtualFile return a MemoryStream read from your SQL server.
Hope this helps.

Copy the files from desktop and Paste in webapplication

I need to Copy the files from desktop and Paste it in Web application created by asp.net with c#.
If the user copy any files from esktop, and paste the file in my webapplication output(i,e i run the application, the user enter using their login and paste some files.
then my application get the file and save it.
so, how can i get the file while user paste?
This is urgent.
Thanks and regards,
Pooja
So I assume you allow user to access your application folder via network sharing, then you met need to monitor that folder so after new file added you can get them, please check this: http://www.techrepublic.com/article/use-the-net-filesystemwatcher-object-to-monitor-directory-changes-in-c/6165137
and hope it helps.
But why not you implement some upload function?

C# download web-content after submit

I need to automate the download of a file from this site http://stats.smith.com/reports/Default.aspx?btnGo=View+Report. My problem is once I click on the submit buttom I lose control and a download dialog pops up. Is there a way to download the file using c# and avoid the download dialog? I'm currently using the WebBrowser object in the Forms assembly to navigate through the page.
Take a look at the WebClient class
If you want to save a downloaded file to the filesystem from a web browser, there must be user interaction. A web page does not have permission to muck about in a client's file system.
If you want to display the page in the browser, you can try removing the Content-Disposition=attachment;... server response header when the file is downloaded. This will only work if the client has the browser set to display such file types inside the browser.
Your question doesn't specify what you're using to download the file.
If you're asking if you can have a program that runs on a client (either a WinForms app, a console app, or a Windows Service) then you can download a file from a web site using the System.Net.WebClient class and calling the DownloadFile() method.
The accepted answer here (slightly different than you question, so it's not a duplicate) has a link to show how to download a file that requires an HTTP post first.
If you're trying to somehow automate Internet Explorer via a javascript from a web page you're hosting to force a file to download on a user without displaying the dialog box, then no. You can't.

Categories

Resources