This should save within the temp folder, but does not. Is there something else i need to do for this to work over the web?
Could i save this to the browsing PC download folder instead???
The file is saved on the server not the client machine. It is not possible for a web application to save a file on a use's machine. The design seems to work during development because the development machine is both the server and the client. Once deployed
the design no longer works.
You mean you expect this file to be saved on the browser machine? A common catch for beginners (though you have 370 posts ?) is that you often develop on your own machine with the very special situation where it is both the web server and the browser side
machine.
But keep in mind that once deployed on a real server, this code runs on the web server and will write at best to server side disks. A web server doesn't have direct to browser side disks.
thank you. i’m always learning. The application is currently deployed on an ftp so i think i will look at saving the pdf to the ftp, then viewing it from there.
thank you. i’m always learning. The application is currently deployed on an ftp so i think i will look at saving the pdf to the ftp, then viewing it from there.
I'm not sure what you are stating. FTP is a protocol for moving files. If you have a PDF file that you wish to share then FTP is a good way to get the file to the host.
masterdineen
How do i save to client pc download folder instead. i know that is possible.
It is NOT possible for a website to save a file on the client PC.
Either create a link the user clicks to download the file or return a File from an Action method. The browser will save the file in the downloads folder. The user can move the file wherever they like.
Don't know about your experience but it seemed you should have been exposed to that difference already or you worked for quite some time on this app and this is your first deployment attempt?
Member
35 Points
375 Posts
Path.GetTempFIleName() wont save as pdf in temp folder
Nov 30, 2020 08:48 PM|masterdineen|LINK
Hello there.
I have an ASP.Net application, and one part that saves a pdf works when debugging, but not when deployed over the web.
this is the snippet im having an issue with
The pdf.save is from a framework called pdfsharp.
This should save within the temp folder, but does not. Is there something else i need to do for this to work over the web?
Could i save this to the browsing PC download folder instead???
All-Star
52241 Points
23303 Posts
Re: Path.GetTempFIleName() wont save as pdf in temp folder
Nov 30, 2020 09:19 PM|mgebhard|LINK
The file is saved on the server not the client machine. It is not possible for a web application to save a file on a use's machine. The design seems to work during development because the development machine is both the server and the client. Once deployed the design no longer works.
All-Star
48320 Points
18004 Posts
Re: Path.GetTempFIleName() wont save as pdf in temp folder
Nov 30, 2020 09:19 PM|PatriceSc|LINK
Hi,
You mean you expect this file to be saved on the browser machine? A common catch for beginners (though you have 370 posts ?) is that you often develop on your own machine with the very special situation where it is both the web server and the browser side machine.
But keep in mind that once deployed on a real server, this code runs on the web server and will write at best to server side disks. A web server doesn't have direct to browser side disks.
Member
35 Points
375 Posts
Re: Path.GetTempFIleName() wont save as pdf in temp folder
Nov 30, 2020 09:52 PM|masterdineen|LINK
what’s 370 posts got to do with it????
Member
35 Points
375 Posts
Re: Path.GetTempFIleName() wont save as pdf in temp folder
Nov 30, 2020 09:56 PM|masterdineen|LINK
Hi mgebhard.
thank you. i’m always learning. The application is currently deployed on an ftp so i think i will look at saving the pdf to the ftp, then viewing it from there.
Member
35 Points
375 Posts
Re: Path.GetTempFIleName() wont save as pdf in temp folder
Nov 30, 2020 10:15 PM|masterdineen|LINK
How do i save to client pc download folder instead. i know that is possible.
All-Star
52241 Points
23303 Posts
Re: Path.GetTempFIleName() wont save as pdf in temp folder
Nov 30, 2020 10:34 PM|mgebhard|LINK
I'm not sure what you are stating. FTP is a protocol for moving files. If you have a PDF file that you wish to share then FTP is a good way to get the file to the host.
It is NOT possible for a website to save a file on the client PC.
Either create a link the user clicks to download the file or return a File from an Action method. The browser will save the file in the downloads folder. The user can move the file wherever they like.
All-Star
48320 Points
18004 Posts
Re: Path.GetTempFIleName() wont save as pdf in temp folder
Nov 30, 2020 11:23 PM|PatriceSc|LINK
Don't know about your experience but it seemed you should have been exposed to that difference already or you worked for quite some time on this app and this is your first deployment attempt?
A web server doesn't have any direct access to client side disks. Instead it can send an httpresponse that will trigger a download dialog in the browser: https://weblog.west-wind.com/posts/2007/may/21/downloading-a-file-with-a-save-as-dialog-in-aspnet