bwarneke
asked on
Web Form File Access with a Secured Network Drive
I've created a VB.Net app that reads a csv file, does some processing, and then loads to a SQL Server DB. The code works fine on our web server. But, we would like to place the csv file on another secured network drive. We can limit it to specific groups, and keep it off our web server.
I've been using the following code:
Dim strFileName As String
strFileName = "V:\VMI\" + ddlPlantNum.SelectedItem.V alue + txtCustNum.Text + ".csv"
Dim file As FileInfo = New FileInfo(strFileName)
File.CopyTo("V:\VMI\DTSLoa d.CSV", True)
I've read some articles about using UNC instead of mapped drives, but both return the same error:
Could not find file "V:\VMI\121367.csv".
or
Could not find file "\\server\VMI\121367.csv".
Permissions are set as 'Full Access' for 'Everyone'. I would like to restrict that in the future, but need to solve the current problem first.
Thanks for your help.
I've been using the following code:
Dim strFileName As String
strFileName = "V:\VMI\" + ddlPlantNum.SelectedItem.V
Dim file As FileInfo = New FileInfo(strFileName)
File.CopyTo("V:\VMI\DTSLoa
I've read some articles about using UNC instead of mapped drives, but both return the same error:
Could not find file "V:\VMI\121367.csv".
or
Could not find file "\\server\VMI\121367.csv".
Permissions are set as 'Full Access' for 'Everyone'. I would like to restrict that in the future, but need to solve the current problem first.
Thanks for your help.
To copy a file:
Imports System
Imports System.IO
Public Module modmain
Sub Main()
Dim strFileName As String
strFileName = "V:\VMI\" + ddlPlantNum.SelectedItem.V alue + txtCustNum.Text + ".csv"
File.Copy(strFileName , "V:\VMI\DTSLoad.CSV")
End Sub
End Module
Imports System
Imports System.IO
Public Module modmain
Sub Main()
Dim strFileName As String
strFileName = "V:\VMI\" + ddlPlantNum.SelectedItem.V
File.Copy(strFileName , "V:\VMI\DTSLoad.CSV")
End Sub
End Module
ASKER
Thanks for the replies.
Bob: I'm running it from a web server that access another file server on the domain.
Dhaest: That's essentially the code I'm now using. I agree it works on a local drive, but not on a network drive.
Bill
Bob: I'm running it from a web server that access another file server on the domain.
Dhaest: That's essentially the code I'm now using. I agree it works on a local drive, but not on a network drive.
Bill
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Bob