Solved

Web Form File Access with a Secured Network Drive

Posted on 2004-04-16
6
247 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now