Copy file from Server to local machine

Hi,

 How can I copy a PDF document from the web server to my local machine (eg. to C:\ Temp  folder)  

 

 

Thanks


badis
0
rbadis
7/24/2008 2:02:26 AM
asp.net.getting-started 91979 articles. 4 followers. Follow

8 Replies
6294 Views

Similar Articles

[PageSpeed] 20
Get it on Google Play
Get it on Apple App Store

This should be simple as downloading any file. Just right click on the link for pdf and click on Save Target As.



Deepak
0
deepakkapoor
7/24/2008 3:59:35 AM
I think you misunderstood me. I'm asking how can you do it programmatically.Eg. on a Button click to copy a document from the server's Path to my machines path. and how paths look like a url or physical?Sample code will be helpful Thanks     
badis
0
rbadis
7/24/2008 5:19:27 AM

Here is some code which will copy test.txt file from the root of my web application to temp folder

  

string sourceFile = Server.MapPath("test.txt");
string destinationFolder = @"c:\temp\test.txt";

File.Copy(sourceFile, destinationFolder);
 
Deepak
0
deepakkapoor
7/24/2008 5:39:57 AM

Hi,

try the following code on button click, it worked for me

Protected Sub btncsv_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncsv.Click

Response.ContentType = "text/plain"

Response.AddHeader("content-disposition", "attachment; filename=""rpvsiteOrder.txt""")

Response.TransmitFile(Server.MapPath("~/csv/rpvsiteOrder.txt"))

Response.End()

End Sub

hope it heped

don 

 

0
dodampegama
7/24/2008 5:51:44 AM

 Deepak you are copying a file from one server location to other.

In the question he clearly asked about copying to the client


Kamran Shahid
Sr. Software Engineer
(MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])
Netprosys Inc.
www.netprosys.com

Remember to click "Mark as Answer" on the post that helps U
0
kamii47
7/24/2008 6:09:25 AM

Yep, this is what I meant, I would like to copy the file from the server to the client machine and this code:

string sourceFile = Server.MapPath("text.txt");

string destinationFolder = @"c:\temp\text.txt";

File.Copy(sourceFile, destinationFolder);

Will not do it, instead it will copy it from the server's application path to the "C:\temp" in the server.

So, any one knows what should be the urls or the paths.

 

Thanks   


badis
0
rbadis
7/24/2008 6:50:49 AM

 sorry dude! maybe today isn't the right day for me.


Deepak
0
deepakkapoor
7/24/2008 9:30:45 AM

You can't do this, any files transferred from a website HAVE to be done via the "Save As..." prompt.

It's possible to do this with a thicker client, either a java applet or an ActiveX control, but they both represent security risks and should be treated with caution.

0
Mr
7/24/2008 9:56:52 AM
Reply:

Similar Artilces:

copy files from the server to a temporary folder on the local machine
We would like to copy desktop applications from the server to a temporary folder on the local machine and run passing parameters. Is this possible? > {quote:title=DENNIS TELL CARLOS wrote:}{quote} > We would like to copy desktop applications from the server to a temporary folder on the local machine and run passing parameters. Is this possible? At face value, this would not be possible; browsers do not allow access to the local machine directly by the server... too much of a security risk. You might accomplish it if you create an ActiveX control, though. Scott is correct tha...

.Net Application for Copying files from remoteserver to local machine on regular time interval.
Hi, How can I create one .Net application which will   Copying files from remoteserver to local machine on regular time interval.I spend a lot of time for searching  this in google.but I am not able to find the exact solution  . If any one having any idea regarding the same please let me know ..   Thanks In Advance Hari      Why use ASP.NET?  A scheduled batch file is easy and clean.  Use the Windows scheduler service. Your other option is writing a Windows service, which isn't ASP.NET. JeffPlease: Don't forget to click "M...

Copy files from local server folder to FTP server
 I need to copy files from local server folder (ie. C:\Temp\) to a FTP server folder (ie. ftp://ftp.abc.com/destFolder/). How can I do that using FileInfo.CopyTo(ftpaddress) and FtpWebRequest handle?     Hi, The below code is about FTP uploading.     using System.IO;    using System.Net;  private void FTPUpload(string filename, string ftpServerIP1 ) { FileInfo fileInf = new FileInfo(filename); string uri = "ftp://" + ftpServerIP1 + "/" + fileInf.Name; FtpWebRequest reqFTP; // Create FtpWebRequest object from ...

How to deploy .net project via 'copy project' in Visual Studio from your local machine to your web development server
Hi ,My IT Director has resigned and I am stuck in the middle of doing his all tasks. For safety reason we removed all functionalities from the developers to deploy any project and only given to IT director. He refuse to help me as he is having problem with the management. I have got a video tutorial for deplying project but not very helpful.Would any body kindly describe the steps required to setup a .net project or any tutorial can be recommended. I have setup website in IIS and pressing 'Copy Project' button in visual studio .net. The dialog box comes and ask me destination project folder ...

How to upload/download the folder and its contents from web server to local machine and local machine to web server
Hi, i am using asp.net with c# and creating the web project In my project Now I am using the Button and listbox and on button click event I am using the code protected void AddFolder_Click(object sender, EventArgs e) { string strPath = ""; string strCaption = "Browse a directory for uploading Album."; //DialogResult dlgResult; string dlgResult = ""; Shell32.ShellClass shl = new Shell32.ShellClass(); Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, strCaption, 0, System.Reflection.Mis...

Keep getting..."Unable to get project file from server",when using vs.net
When trying to open any existing asp.net project in Visual Studio it keeps giving me the message above. It is also throwing an error when I create the project in the first place, it happens when a dos window is opened, the text in the dos window is running "Common Language Runtime Minidump Utility version 1.0.3705.0" and then VS craps out says there was an error and shuts down. I've re-installed the .net components and framework with no avail, and FrontPage extensions etc.. are all installed. I'm running XP professional and have installed IIS 5.1. This is driving me fec...

I am hosted this site on windows server 2003 and I get an error message?? but I dont get this on my local machine?
here is the error message I am getting:  Any help is appreciated.   Thanks.   The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. A name was started with an invalid character. Error processing resource 'http://misfs/techprograms/Downloads.aspx'. Line 1...<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Downloads.aspx.vb" Inherits... The site is not configured for...

Schedule task windows 2003 to run batch file to copy files from NW server to local drive
Hi All, IS there a way to schedule task to run a batch file that copy files from the NW server to local drive or execute a program from the NW server using UNC without logging in the workstation? Thanks, Steve spham68@yahoo.com wrote: > Hi All, > > IS there a way to schedule task to run a batch file that copy files from > the NW server to local drive or execute a program from the NW server using > UNC without logging in the workstation? > > Thanks, > > Steve > > To do so you would need to run the process as a service us...

Copying a file from the client machine to the server
I want to copy a file from a specific path on the client machine to the server. The problem is that I want to do it without any user interaction (No...I am not trying to hack the system). Is there ay way of doing it. I want to do it when the user logs on to the system. Shailesh Sure, but it requires installing an application on the client machine. Will that work? DonDon Kiely, MCP, MCSDIn the Last Frontier, Interior AlaskaPlease post questions and replies to the forum! And remember to MARK AS ANSWER when someone definitively answers a question or resolves a problem! Yeah, I think y...

copy directory from local machine to server?
how do i copy a directory from my machine to the server? the server says its unable to find the folder.. it is looking for the path on the server and not on my machine.. how do i resolve this? System.IO.DirectoryNotFoundException: Could not find a part of the path 'd:\photos'. Hi, Since the code is running on the Web Server, it will give you the path of the folders on the server only. You cannot copy a directory straightaway through code, you can use FileUpload controls to copy multiple files from client to server. HTH, VivekSocial Networking Platform in ASP.NET || Join now: CodeASP.NET Community Please mark the most helpful reply/replies as "Answer"....

Copy file from server to local drive?
Hello,I want to copy a file from server  to a D:\ drive on my machine, but fail to copy it, Can someone guide me to the right way of how to make a copy from the server host to the local machine? thanks..Here is a copy of string I have in C#, but not working... I didn't get to the checking if (File.Exists(path1)),  the file does exist in the path1, but it didn't read into the path to check if the file is there, So I'm wondering if I declare the server directory to the file is correct, can someone help me out with this? this is urgent, thanks a lot....  string path1...

Copying files local to the IIS server...?
I've got an ASP.NET app running fine on my local dev box, but when I deply to the test server I keep getting file not found errors on the new file I'm trying to create...the pathing seems to come out alright, but no file is actually copied.  This a security issue?...the ASPNET user account has full access to the directories I'm copying to\from...thats about all I can guess at.                //Delete Duplicate files, we shouldnt ever get this, but just in case       &nb...

Copying files from server to server
--____UXFLEXDGVUTPRTDRYJYN____ Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; modification-date="Fri, 7 Dec 2006 06:48:39 -0600" hello all, I want to run a cron job that will copy an entire directory from server to = server. I have been trying to use Toolbox 2.17 to do it, only it does not = work. I have messed with the syntax and the only thing I can think of is = there is some sort of authentication issue. I can copy a directory from = volume to volume on the same server just fine. Can so...

Copy files from server to server...how?
I've heard "try toolbox" and to tell you the truth I'm a little fuzzy on that one. I can login, great... I've heard that cpqfm.nlm can do this. What is the nomenclature for the server to want to copy to? Thanks, Troy On Wed, 16 Aug 2006 11:01:13 -0700, Troy H <in2theabyss@gmail.com> wrote: > I've heard "try toolbox" and to tell you the truth I'm a little fuzzy on > that one. I can login, great... The toolbox help file is a little bit brief, but since most of the commands are clones of common CLI stuff (move, copy...

server to server file copy
Hi, I''m in a different city than my servers and I want to copy a large folder from one volume to another on the same server. If I do this from my workstation, it copies the files to my workstation and then copies them back to the other volume. Is there a way for me to prevent me being the middle man on this copy? Thanks Scott S If you can get to the server console, you can use Toolbox for this, load it on the console and you get some dos-like commands. -- Andrew C Taubman Novell Support Forums Volunteer SysOp http://support.novell.com/forums (Sorry, support is not provided via e-mail) Opinions expressed above are not necessarily those of Novell Inc. Scott S wrote: > Hi, > I''m in a different city than my servers and I want to copy a large > folder from one volume to another on the same server. If I do this > from my workstation, it copies the files to my workstation and then > copies them back to the other volume. Is there a way for me to > prevent me being the middle man on this copy? Besides Andrew's suggestion you could also use the consolidation utility but that is probably a bit of overkill for the job. -- Cheers, Edward On Tue, 07 Nov 2006 14:15:19 -0800, Andrew C Taubman <ataubman.RemoveThisToMailMe@novell.AndThis.com> wrote: > If you can get to the server console, you can use Toolbox for this, load > it on the console and you get some dos-like commands...

File copy server to server ?
Does anyone know of a util that will allow for a direct server to server file or folder copy? If you use explorer on a windows workstation, the file traffic must past through your workstation, or at least, be controlled by your workstation. I'd like something that you could set, and then shutdown your windows box even, if you had to. The only thing I know of is toolbox, at the server itself, but that requires it be loaded on both servers. Ncopy is another example of where you must leave the window open. We semi-frequently have to transfer hundreds of megabytes of user folders f...

Copying jpg files to local machine from URLs
Is there a way within a PB application to copy JPGs and other documents that live on one of our corporate websites to the local machine that is running the application. I currently have set up a window that has a list of resources for a given retreival argument. The user can click on the individual items and there browser opens to display the image or document (using HyperlinkToURL Fx). Now, users would like to be able to select multiple items and save them to there local machine so that they may burn CDs for third parties. Have you taken a look at the getURL( ) function? You s...

copying files from local host to dedicated server
hi all  advance thanks. i hosted my website in a US dedicated server.this is my first website. am accesing this US dedicated server using remote desktop connection. am transfering files from local host to dedicated server using copy paste method.. but copying files from local host to dedicated server taking too much time.. my doubt is 1.is any other way we have for transfering files from local host to remote dedicated server? 2.extra payment we have for downloading files using our net connection, whether this copy paste from dedicated to local host is downloading files or...

ERROR: Unable to get local copy of file
I am attempting to upgrade an ASP.NET 1.1 site to ASP.NET 2.0 but I got 76 errors: ERROR: Unable to get local copy of file... The unusual aspect of this web site is that the ASPX pages are all contained within a directory named "secure" and the vbproj file has been edited to change the Output Path to "secure\bin\". This was done to keep the entire web application in a SSL secured directory except for the initial log in page. This appears to have screwed up the conversion wizard and I can't find any information on how to fix it because this is an unusual case.<...

Copying font file to the local client machine
Hi, I have an application that generate a report using microsoft word, I am using a spacific type of font and when I run the application I need to copy the file into windows fonts folder in the client machine.  My code: before the class begin I declared the following:<Assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, _ All := "HKEY_LOCAL_MACHINE")> After clicking the Generate btn the font must be loaded: '--- Function to Add the Font '---- If Not File.Exists("C:\Windows\Fonts\ae_AlBattar.TTF") Then File.Copy(server.MapPath(&q...

Copying file from local to SharePoint server location
Now on my PC I can use explorer to open a location on our SP server (location eg https://sp.myserver.com/site/Documents/). And from there I can copy/paste a file from eg my C:\ drive. I need to replicate the copy process progmatically. FileCopy() doesn't do it - seems to be the http:// bit that's causing problems I reckon? ...

Getting Fullname on local machine works but not on server
Ok im trying to get a persons full name from LDAP when they come to a site.  This site is an Intranet site and everyone who comes to it is already logged into the network.  It runs fine when debugging in Visual Studio 2005 on the local machine, however when I try to visit the site through the browser it says "Index was outside the bounds of the array.done "  Does anyone know what might be causing this?'Get persons Name Dim entry As New DirectoryEntry("LDAP://Domain") Try ' instantiate and assign directoryentry ...

Downloading a file from the web server to local machine
Hi, This is part of the code that I have to download a file from the webserver to the local machine: WebClient myWebClient = new WebClient(); myStringWebResource = remoteUri + fileName; myWebClient.DownloadFile(myStringWebResource, "C:/" + fileName); However, the file cannot be downloaded to C:/filename because of permission problems. How can I allow successful download from webserver to local client by avoiding the permission/security problem? Regards, sandyhttp://www.thequinn.infohttp://www.sksdataservices.comhttp://www.infobasket.info You need permission to do that.Mikael Söderströ...

Copy a file from local comp to IIS server ?
HEllo,I want to copy a file from local comp to server IIS ? using ASP not ASP.NET.If anybody have some script how to do thisThanks for all. Luk  http://www.google.com/search?sourceid=navclient&ie=UTF-8&rlz=1T4GZHZ_enUS225US225&q=file+upload+classic+ASPDavid WierMCP/ASPInsiderASPNet101.com - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(Please 'Mark as Answer' when it applies) OK...

Web resources about - Copy file from Server to local machine - asp.net.getting-started

Machine - Wikipedia, the free encyclopedia
A machine is a tool containing one or more parts that uses energy to perform an intended action. Machines are usually powered by mechanical, ...

Poker machine legend Len Ainsworth wants to cash in, his family cannot
As he approaches his 93rd birthday, you could forgive pokie legend Len Ainsworth for wanting to cash in.

Poker machine legend Len Ainsworth wants to cash in, his family cannot
As he approaches his 93rd birthday, you could forgive pokie legend Len Ainsworth for wanting to cash in.

DOD officials say autonomous killing machines deserve a look
... kind, though it has heavily invested in the development of armed "unmanned ground vehicles." The military did deploy remote-controlled machine ...

BMW now wants to build 'ultimate machine driver'
Filed under: Green , BMW , Emerging Technologies , Electric , Future BMW wants half its research and development staff to be computer programmers ...

Pretty Hate Machine: Warriors Forcing Old Guard to Confront New Template for NBA - Bleacher Report
A guy walks into a bar… Two older patrons see the overt joy emanating from the guy named Stephen Curry , star of the history-making Golden State ...

Eloy Delgado Talks Cuba Policy As He Takes On The Machine In Hudson County, New Jersey
... the 2015-16 congressional session is the worst of any New Jersey Democrat other than Donald Norcross, the conservative South Jersey Machine ...

Snapchat's money machine looks a lot like Facebook in the early days
Snapchat expects to ring up between $300 million and $350 million in revenue this year, according to a report in Re/code. That's a nice haul ...

Man vs machine: Who will win? - Business Insider Deutschland
Demis Hassabis is pitting his algorithm against world Go champion Lee Sedol.

CORRECTING and REPLACING Meta Launches Meta 2, First “Natural Machine” Augmented Reality Product
CORRECTING and REPLACING Meta Launches Meta 2, First “Natural Machine” Augmented Reality Product Business Wire (press release) Technology pundit ...

Resources last updated: 3/8/2016 6:13:51 PM