G
Guest
Hello All,
I am developing an application in visual basic 2005 that will run
continuously in the background on a users workstation. This application will
automatically transfer files from the local machine to a remote server and
vise versa. It checks for the files on a timed interval. I have two problems
with this application that I am having trouble figuring out:
The first problem is that the cmd.exe shell pops up on the screen every time
it maps the drive. The application needs to be completely 'invisible' to the
user. I cannot have something popping up every several minutes while they are
trying to work.
The second issue is that I do not want to let a continuous connection to the
remote server so I have mapped a network drive to the remote server using
process.start. I have provided administrative credentials when creating the
drive. Local users do not have permission to connect to the remote server.
Also, I only want to create the drive when necessary, and then close it when
the current process is finished with it.
The drive mapping shows in My Computer when I check for it. However, when
the code tries to access the drive to transfer the files, I get an error and
the program shuts down.
The error is: system.unauthorizedaccess, eventtype: clr20r3.
I am assuming this has something to do with the user credentials, so I tried
creating the mapped drive using the same command lines in my code using the
command prompt. I was able to successfully create the mapped drive and access
it under the local user account
Any ideas/help would greatly be appreciated.
This is the section of code that I am calling when I want to create the drive:
Try
srvConn = New System.Diagnostics.Process
srvConn.StartInfo.UseShellExecute = False
srvConn.StartInfo.RedirectStandardError = True
srvConn.StartInfo.RedirectStandardOutput = True
srvConn.StartInfo.FileName = ("net.exe")
srvConn.StartInfo.Arguments = "use z: \\server\share" & " " &
My.Settings.rbsSrvPwd & "/user:" & My.Settings.rbsSrvUsr
srvConn.Start()
srvConn.WaitForExit()
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
Microsoft.VisualBasic.FileIO.FileSystem.WriteAllText(My.Settings.logPoll,
"Error: " & ex.Message & " occurred in rbsSrvConnection:rbsConnOpen" &
vbCrLf, True)
End Try
I am developing an application in visual basic 2005 that will run
continuously in the background on a users workstation. This application will
automatically transfer files from the local machine to a remote server and
vise versa. It checks for the files on a timed interval. I have two problems
with this application that I am having trouble figuring out:
The first problem is that the cmd.exe shell pops up on the screen every time
it maps the drive. The application needs to be completely 'invisible' to the
user. I cannot have something popping up every several minutes while they are
trying to work.
The second issue is that I do not want to let a continuous connection to the
remote server so I have mapped a network drive to the remote server using
process.start. I have provided administrative credentials when creating the
drive. Local users do not have permission to connect to the remote server.
Also, I only want to create the drive when necessary, and then close it when
the current process is finished with it.
The drive mapping shows in My Computer when I check for it. However, when
the code tries to access the drive to transfer the files, I get an error and
the program shuts down.
The error is: system.unauthorizedaccess, eventtype: clr20r3.
I am assuming this has something to do with the user credentials, so I tried
creating the mapped drive using the same command lines in my code using the
command prompt. I was able to successfully create the mapped drive and access
it under the local user account
Any ideas/help would greatly be appreciated.
This is the section of code that I am calling when I want to create the drive:
Try
srvConn = New System.Diagnostics.Process
srvConn.StartInfo.UseShellExecute = False
srvConn.StartInfo.RedirectStandardError = True
srvConn.StartInfo.RedirectStandardOutput = True
srvConn.StartInfo.FileName = ("net.exe")
srvConn.StartInfo.Arguments = "use z: \\server\share" & " " &
My.Settings.rbsSrvPwd & "/user:" & My.Settings.rbsSrvUsr
srvConn.Start()
srvConn.WaitForExit()
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
Microsoft.VisualBasic.FileIO.FileSystem.WriteAllText(My.Settings.logPoll,
"Error: " & ex.Message & " occurred in rbsSrvConnection:rbsConnOpen" &
vbCrLf, True)
End Try