473,770 Members | 1,989 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 9422
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
25844
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
3107
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
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
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...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
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...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
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.