Link to home
Start Free TrialLog in
Avatar of bwarneke
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.Value + txtCustNum.Text + ".csv"
Dim file As FileInfo = New FileInfo(strFileName)

File.CopyTo("V:\VMI\DTSLoad.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.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Where are you running the application from?

Bob
To copy a file:

Imports System
Imports System.IO



Public Module modmain

   Sub Main()
     Dim strFileName As String
    strFileName = "V:\VMI\" + ddlPlantNum.SelectedItem.Value + txtCustNum.Text + ".csv"
      File.Copy(strFileName , "V:\VMI\DTSLoad.CSV")
   End Sub
End Module
Avatar of bwarneke
bwarneke

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



ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial