473,765 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save file from the Server to User's Desktop

EC
I am trying to save a file to an end users desktop from the Server on the
click of a button. This works when run the application on my local but does
not work when the application is running on the web server because Dim
copyfiletodeskt op As String = "C:\temp\" points to the Web server’s C drive
and not the end users C while when I run the application on my desktop, C
points to my C Drive and that is why it works.

Does anyone know how I can change this line of code to point to end users
(external) Desktop and get to file to their desktops no matter their computer
setup?
Please Note that I know how to change it to "C:\Documen ts and
Settings\myprof ilename\Desktop \" but the problem is this will not work for
everyone since I don't know their profile name and is not the best way to do
it.

Thanks for your help.
EC.

Jul 22 '05 #1
3 9421
You cant - its restricted by sandbox security. The best you can do is start
a binary donwload from an asp.net page and hope the user accepts it.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"EC" <EC@discussions .microsoft.com> wrote in message
news:F8******** *************** ***********@mic rosoft.com...
I am trying to save a file to an end users desktop from the Server on the
click of a button. This works when run the application on my local but
does
not work when the application is running on the web server because Dim
copyfiletodeskt op As String = "C:\temp\" points to the Web server's C
drive
and not the end users C while when I run the application on my desktop, C
points to my C Drive and that is why it works.

Does anyone know how I can change this line of code to point to end users
(external) Desktop and get to file to their desktops no matter their
computer
setup?
Please Note that I know how to change it to "C:\Documen ts and
Settings\myprof ilename\Desktop \" but the problem is this will not work for
everyone since I don't know their profile name and is not the best way to
do
it.

Thanks for your help.
EC.

Jul 22 '05 #2
EC
Hello John,

Thanks for your help. I have resolved it by adding the following code below:

Dim myFile As FileInfo = New FileInfo(strFil eNamePath)

Response.Clear( )

'now we send the file header minus the resources extension.

Response.AddHea der("Content-Disposition", "attachment ; filename=" &
Replace(myFile. Name, ".resources ", ""))

Response.AddHea der("Content-Length", myFile.Length.T oString())

Response.Conten tType = "applicatio n/octet-stream"

Response.WriteF ile(myFile.Full Name)

Response.End()

Thanks,
EC
"John Timney (ASP.NET MVP)" wrote:
You cant - its restricted by sandbox security. The best you can do is start
a binary donwload from an asp.net page and hope the user accepts it.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"EC" <EC@discussions .microsoft.com> wrote in message
news:F8******** *************** ***********@mic rosoft.com...
I am trying to save a file to an end users desktop from the Server on the
click of a button. This works when run the application on my local but
does
not work when the application is running on the web server because Dim
copyfiletodeskt op As String = "C:\temp\" points to the Web server's C
drive
and not the end users C while when I run the application on my desktop, C
points to my C Drive and that is why it works.

Does anyone know how I can change this line of code to point to end users
(external) Desktop and get to file to their desktops no matter their
computer
setup?
Please Note that I know how to change it to "C:\Documen ts and
Settings\myprof ilename\Desktop \" but the problem is this will not work for
everyone since I don't know their profile name and is not the best way to
do
it.

Thanks for your help.
EC.


Jul 25 '05 #3
glad your all sorted :)

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"EC" <EC@discussions .microsoft.com> wrote in message
news:47******** *************** ***********@mic rosoft.com...
Hello John,

Thanks for your help. I have resolved it by adding the following code
below:

Dim myFile As FileInfo = New FileInfo(strFil eNamePath)

Response.Clear( )

'now we send the file header minus the resources extension.

Response.AddHea der("Content-Disposition", "attachment ; filename=" &
Replace(myFile. Name, ".resources ", ""))

Response.AddHea der("Content-Length", myFile.Length.T oString())

Response.Conten tType = "applicatio n/octet-stream"

Response.WriteF ile(myFile.Full Name)

Response.End()

Thanks,
EC
"John Timney (ASP.NET MVP)" wrote:
You cant - its restricted by sandbox security. The best you can do is
start
a binary donwload from an asp.net page and hope the user accepts it.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"EC" <EC@discussions .microsoft.com> wrote in message
news:F8******** *************** ***********@mic rosoft.com...
>I am trying to save a file to an end users desktop from the Server on
>the
> click of a button. This works when run the application on my local but
> does
> not work when the application is running on the web server because Dim
> copyfiletodeskt op As String = "C:\temp\" points to the Web server's C
> drive
> and not the end users C while when I run the application on my desktop,
> C
> points to my C Drive and that is why it works.
>
> Does anyone know how I can change this line of code to point to end
> users
> (external) Desktop and get to file to their desktops no matter their
> computer
> setup?
> Please Note that I know how to change it to "C:\Documen ts and
> Settings\myprof ilename\Desktop \" but the problem is this will not work
> for
> everyone since I don't know their profile name and is not the best way
> to
> do
> it.
>
> Thanks for your help.
> EC.
>


Jul 25 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
25843
by: palgrave | last post by:
Hi, How do you create an html link from a web page to a read-only excel spreadsheet without the browser asking if the user wants to open it or save it?
10
2412
by: Dica | last post by:
i've got an app that needs to connect to sql server and login with a useName/password. currently, my app saves this info in an XML file in plain text (i.e. no encryption). everytime the app is opened, the XML file is read and the userName/password used to establish the sql connection. is this the normal way of doing things, or is it smarter to save these set tings elsewhere, like the registry? if saving to XML is deemed appropriate, should...
8
2403
by: kieran | last post by:
Hi, I want to download an image from the web and save it locally. I have spent all day messing about with this and am still no where. We have a firewall so i use the below code. I know it works down to the line as i also use this code to download an xml file from the net. I have been messing around with all sorts of ways to stream the image into a local file and save it. but no luck. Am i totally off key here, can anyone point me...
4
4514
by: sunilj20 | last post by:
Hello, I have a requirement wherein, a user clicks on a file name in an ASP.NET web application, and the file should automatically be downloaded (Without showing the "Open", "Save As") in the local machine at a pre defined path (path defined in the registry), and launch the file in its associated application. I think this can be done through ActiveX Controls, but i dont know how to create ActiveX controls in .NET??
2
3106
by: Scott M. Lyon | last post by:
I'm working on a WinForm application, and recently was informed that I need to create an "Export" function for the data (stored in SQL Server), in a specific (TXT, tab delimited) format. I'd like to figure out a way to bring up the "Open or Save" dialog similar to what we see on Web Pages, but with a minimal amount of coding (especially considering this isn't a Web application), but would then allow me to create a TXT file and either...
3
311
by: EC | last post by:
I am trying to save a file to an end users desktop from the Server on the click of a button. This works when run the application on my local but does not work when the application is running on the web server because Dim copyfiletodesktop As String = "C:\temp\" points to the Web server’s C drive and not the end users C while when I run the application on my desktop, C points to my C Drive and that is why it works. Does anyone know how...
4
6262
by: Jonny | last post by:
Hello Group How do I open a Save File Dialog from an ASPX page behind a browse button? Any help would be fantastic!! I am using ASP.NET 1.1 using VB.NET as the coding language TIA
1
5615
by: pbrown | last post by:
Hi, I'm using VB.net 2003, and I have a problem. I need a way of saving a file directly to the desktop, without hardcoding the direct path to the desktop into the program. For example, I'm trying to save an output file to the desktop, so that users don't have to sift through a million folders to find it. Problem is, this will be running on multiple machines, each of which has its own different path to the desktop, these being a couple of...
2
1652
by: JPS | last post by:
We have a ASP.Net/SQL Server application that is used as a document management system. The documents are stored per project. The files are stored on a file server but we store the file name in the database and when displaying the files build a grid at run time to allow users to view the files like http://servername/files/filename.doc The problem we have currently is users have to use the web form to upload the files to database. Most...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.