How to save .pdf file from server to client side? - c#

I need some suggestion about how to save .pdf file from server to client side. I'm using C# console application to generate pdf file and save in server local c and I manage to do it by using .ExportToDisk(ExportFormatType.PortableDocFormat, report). Now I need to save the file to client side rather than save in server local c because my user aren't allowed to access the server. Appreciate if someone can help me about this. Thanks

Your best option would be to export to a UNC path which the users can access. Don't forget your console application will have to run as a user with write access to the UNC path.

Related

Allow client to view/pritn pdf file stored on file system of server using website

My requirement is to let client view/print pdf files from folder and that folder is on server and file stored in this folder manually i.e. saving files in that folder . How I can live/share that folder so that client can view/print pdf files using website . how to keep check on permissions etc.
I have no idea how to do it .....
any guidance link ...
thanks in advance ......
below is a brief idea since it's not clear what you want exactly
get the files from server
use a ftp server to keep files and you can connect to server and get files via ftp
then you can print
if you are using normal windows server you need to run a service to return file
create a client to connect to your service in the server and get the files
print it

Need to open the file in client's machine

The question is related to asp.net web site application.
Requirement 1: Need to open an excel file in clients' machine and allow the user/client to modify the
opened excel file.
// After downloading file from ftp location to below path 'excelPath'
String excelPath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MyApp", "Excel1.xlsx");
System.Diagnostics.Process.Start(excelPath);
Output: Above code working fine with visual studio, but not working after hosting it. Also it seems the file will open in server machine but my requirement is to open it in client machine.
Note: for hosting I am using Microsoft Server 2008 R2.
You cannot access client machine's file system, but user may upload his excel file to your application. Save uploaded file in storage. Let user edit uploaded file and then download it.
Don't use Process.Start as it will not work on client machine
Rather provide a link to the excel file and when the user will click on it, s/he will be prompted to open
I used a Desktop application to fix this. Implemented a flag to check whether the user is logged in, if user is logged in downloaded the excel file and opened it, and pushing data to server periodically till the user is logged in.
This solved my requirements.
Thanks all for there helpful comments.

How to Connect to SFTP server using PPK file using C#

I have previously implemented an application that connects to a FTP server and downloads/uploads files. This time i need to create the same kind of application but i have a problem. I don't know how to use the PPK(private key) file to connect to the server.
Application specs:
Connect to Server using SFTP and PPK(no idea how to do this.).
Download files from the server and write them locally (this part i know how to do).
If u need more information u can just write them in the comments.
thanks in advanced.

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.

Changing a file on the server using a local windows app

I am writing an automation to update the contents on an excel sheet(in c#) present on our server. Our server has various portals and has different credentials. How could I fetch the file on my portal to my local computer to make some changes to it.
Is your computer on a domain with the server? If so...
Run as a user who has access and manipulate it via UNC paths just like normal paths... for example you would load #"\Servername\share\file.xls" instead of #"C:\path\file.xls".

Categories

Resources