473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Copying Files

Is it possible to copy a file from one location to the desktop of the
user on the local lan? The webserver is IIS6, and all users are active
directory accounts. I realize that its a security risk to do such
things, but it would be ok in our given environment. I can't think of a
simple way to do it.

I was thinking of something similar to this:

Protected Sub btnPlaceIcon_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnPlaceIcon.Click

IO.File.Copy("\\server1\share\Finance.mdb",
"%USERPROFILE%\Desktop\DataTest.mdb", True)

End Sub

This doesn't work because of the %userprofile%, but if I make it the C
drive, like this

IO.File.Copy("\\server1\share\Finance.mdb", "c:\DataTest.mdb", True)

then it just copies the file to the web server's C drive, of course.
The other option would be for them to click a link, which is anchored to
a batch file or vb script file, which they can then run. I have several
links that do that already so I was hoping to do this a little
differently, with less 'clicks'.

Any ideas, anyone?

TIA,
Jim
Jul 6 '06 #1
3 1292
Jim in Arizona wrote:
Is it possible to copy a file from one location to the desktop of the
user on the local lan? The webserver is IIS6, and all users are active
directory accounts. I realize that its a security risk to do such
things, but it would be ok in our given environment. I can't think of a
simple way to do it.

I was thinking of something similar to this:

Protected Sub btnPlaceIcon_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnPlaceIcon.Click

IO.File.Copy("\\server1\share\Finance.mdb",
"%USERPROFILE%\Desktop\DataTest.mdb", True)

End Sub

This doesn't work because of the %userprofile%, but if I make it the C
drive, like this

IO.File.Copy("\\server1\share\Finance.mdb", "c:\DataTest.mdb", True)

then it just copies the file to the web server's C drive, of course.
The other option would be for them to click a link, which is anchored to
a batch file or vb script file, which they can then run. I have several
links that do that already so I was hoping to do this a little
differently, with less 'clicks'.

Any ideas, anyone?

TIA,
Jim

I tried this:

Protected Sub btnPlaceIcon_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnPlaceIcon.Click

Dim pcname As String
pcname = Request.ServerVariables("REMOTE_HOST")

IO.File.Copy("\\server1\share\P8200811.jpg",
"\\pcname\%USERPROFILE%\Desktop\testimage.jpg" , True)

End Sub

And it would have probably worked if it weren't for a permissions issue.
I'm assuming this is because the ASP.NET account doesn't have read/write
permissions on the server/client.

Would there be a way to specify credentials when doing this file copy
method, or could the credentials of the person accessing the webpage be
used since everyone is logged on via Active Directory?
Jul 6 '06 #2
Maybe impersonation would work in this instance (along with Integrated
Windows Authentication on the web server)?

I don't think %USERPROFILE% is going to work in this instance either.

What is the reasoning behind this? Maybe there's a better way to solve your
problem?

"Jim in Arizona" <ti*******@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Jim in Arizona wrote:
>Is it possible to copy a file from one location to the desktop of the
user on the local lan? The webserver is IIS6, and all users are active
directory accounts. I realize that its a security risk to do such things,
but it would be ok in our given environment. I can't think of a simple
way to do it.

I was thinking of something similar to this:

Protected Sub btnPlaceIcon_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnPlaceIcon.Click

IO.File.Copy("\\server1\share\Finance.mdb",
"%USERPROFILE%\Desktop\DataTest.mdb", True)

End Sub

This doesn't work because of the %userprofile%, but if I make it the C
drive, like this

IO.File.Copy("\\server1\share\Finance.mdb", "c:\DataTest.mdb", True)

then it just copies the file to the web server's C drive, of course.
The other option would be for them to click a link, which is anchored to
a batch file or vb script file, which they can then run. I have several
links that do that already so I was hoping to do this a little
differently, with less 'clicks'.

Any ideas, anyone?

TIA,
Jim


I tried this:

Protected Sub btnPlaceIcon_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnPlaceIcon.Click

Dim pcname As String
pcname = Request.ServerVariables("REMOTE_HOST")

IO.File.Copy("\\server1\share\P8200811.jpg",
"\\pcname\%USERPROFILE%\Desktop\testimage.jpg" , True)

End Sub

And it would have probably worked if it weren't for a permissions issue.
I'm assuming this is because the ASP.NET account doesn't have read/write
permissions on the server/client.

Would there be a way to specify credentials when doing this file copy
method, or could the credentials of the person accessing the webpage be
used since everyone is logged on via Active Directory?

Jul 7 '06 #3
Brendan Green wrote:
Maybe impersonation would work in this instance (along with Integrated
Windows Authentication on the web server)?

I don't think %USERPROFILE% is going to work in this instance either.

What is the reasoning behind this? Maybe there's a better way to solve your
problem?

The main reason is app (in this case, access database front end)
deployment. On our internal website, we have a page that employees can
go to with links that, when clicked, run a batch file that copies down a
front end of an access database from a server to their desktop. All they
do is click 'run' when prompted after they click the link.

In this case I was trying to create a little security on who could get
the front end of this database (easily) with a simple passcode .. ie:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Page.IsPostBack Then
If txtAccessCode.Text = "456" Then
lblInvalidCode.Visible = False
pnlAccess.Visible = False
pnlAuthorized.Visible = True

Else
lblInvalidCode.Visible = True
End If
Else
pnlAccess.Visible = True
lblInvalidCode.Visible = False
pnlAuthorized.Visible = False

End If
End Sub

Just something simple but effective enough for our purposes. Within the
pnlAuthorized panel is a button, that when clicked, would run the code
to copy the access database file from server to their desktop.
Jul 7 '06 #4

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

Similar topics

3
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore...
4
by: Alex Vinokur | last post by:
Copying files : input to output =============================== C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer...
0
by: Dan | last post by:
We debug a VB.Net App that uses compact framework to a DAP Windows CE.Net device. When I debug I would like to only have the EXE copied down. Right now it copies any referrences as well and...
2
by: | last post by:
Hello, I have a program that starts a new thread to backup files from a computer over the network to our server. The problem is when it is copying the files you can hardly navigate around in...
10
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in...
4
by: zMisc | last post by:
Is it possible to copy a table from one schema to another schema by just copying the frm file to the directory for the new schema? What is the best way to create a new database with all the...
6
by: Jim Heavey | last post by:
I have written a little application which copies files from one location to another location. Before it copies the file, it ensure the directory for both the from and to locations is valid. It...
2
by: Edhy Rijo [Progytech] | last post by:
Hi All, I am learning VB.NET and building small application that will do the following: 1.. Copy all files from a DVD to a specific folder in the hard drive and overwrite all files always. The...
6
by: kimiraikkonen | last post by:
Hi, I use system.io.file class to copy files but i have a difficulty about implementing a basic / XP-like progress bar indicator during copying process. My code is this with no progress bar,...
13
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.