Solved

Web Form File Access with a Secured Network Drive

Posted on 2004-04-16
6
257 Views
Last Modified: 2010-04-24
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.
0
Comment
Question by:bwarneke
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10846241
Where are you running the application from?

Bob
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 10857056
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
0
 

Author Comment

by:bwarneke
ID: 10863926
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



0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 10870604
My first take on this would be to use Impersonation in the web.config file.

Bob
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question