473,748 Members | 10,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Cl ick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnPlaceIcon.Cl ick

IO.File.Copy("\ \server1\share\ Finance.mdb",
"%USERPROFILE%\ Desktop\DataTes t.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.md b", 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 1304
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_Cl ick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnPlaceIcon.Cl ick

IO.File.Copy("\ \server1\share\ Finance.mdb",
"%USERPROFILE%\ Desktop\DataTes t.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.md b", 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_Cl ick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnPlaceIcon.Cl ick

Dim pcname As String
pcname = Request.ServerV ariables("REMOT E_HOST")

IO.File.Copy("\ \server1\share\ P8200811.jpg",
"\\pcname\%USER PROFILE%\Deskto p\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*******@hotm ail.comwrote in message
news:%2******** ********@TK2MSF TNGP05.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_Cl ick(ByVal sender As Object, ByVal e As
System.EventAr gs) Handles btnPlaceIcon.Cl ick

IO.File.Copy("\ \server1\share\ Finance.mdb",
"%USERPROFILE% \Desktop\DataTe st.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.md b", 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_Cl ick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnPlaceIcon.Cl ick

Dim pcname As String
pcname = Request.ServerV ariables("REMOT E_HOST")

IO.File.Copy("\ \server1\share\ P8200811.jpg",
"\\pcname\%USER PROFILE%\Deskto p\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.EventArg s) Handles Me.Load

If Page.IsPostBack Then
If txtAccessCode.T ext = "456" Then
lblInvalidCode. Visible = False
pnlAccess.Visib le = False
pnlAuthorized.V isible = True

Else
lblInvalidCode. Visible = True
End If
Else
pnlAccess.Visib le = True
lblInvalidCode. Visible = False
pnlAuthorized.V isible = 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
3654
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 my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
4
2979
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 http://alexvn.freeservers.com/s1/perfometer.html
0
1551
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 checks the .NET CF version. The first message I receive is: Files in the package 'netcf.all.wce4.armv4.cab' are more recent on the device than on the development computer. Consider upgrading to the latest version. Files affected are:
2
1853
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 windows explorer. I would like this program to backup users files somewhat transparently. As it is now they can hardly navigate through their files and folders while it's running. Is there a way to slow this proccess down or keep it from tying...
10
7838
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 'to.txt' I specify where to copy it - After I read content of 'to.txt' I create one more subfolder named by current date and thats where everything gets to be copied
4
15423
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 tables in it automatically? I was hoping to have the tables (the frm files) included in a subdirectory and when required, just create a new schema then copy all the frm files into it.
6
1988
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 also ensures that the from file exists. All that being successful, it attempts to copy the file, but each time I get an exception in which the text of the message says "The process can not copy the file XXXXXXXXX because it is being used by...
2
8132
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 problem I am facing is that the copy statement I am using is that when overwriting the files it will prompt for each file, so I can not find an option to tell it to overwrite all. If strCopyToFolder.EndsWith("\") = False Then strCopyToFolder +=...
6
4982
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, or i couldn't find sth which give totalbytes/written bytes class. And does system.io.file class provide awaring of the chunks / bytes of the files bytes which are written?
13
10712
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 process the file. The appearance of the command file triggers the device to grab the original file. My problem is I don't want to write the command file to the device until the original file from the workflow has been copied completely. Since these...
0
8830
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
9370
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...
0
9247
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...
1
6796
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
6074
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
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
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
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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.