Link to home
Start Free TrialLog in
Avatar of Member_2_7967119
Member_2_7967119

asked on

Shared Folder on the web servers running Windows server 2012 is not able to recognize any shared folders.

I have an asp.net web application that is running on IIS installed on a windows OS.

We have 2 shared folder configured on the web server which share the folders on the client computers.

For illustation, let me say the Drive E is shared to  scanned folder on Client machine C1 and Drive F is shared with Scanned folder on client machine C2 etc.

The purpose of sharing the drives & folders is to allow the files from C1 and C2 to be copied over to the folders residing on the server.

So when I run the website on c1, i am assuming that the files in C1 are copied over to the E drive on the server but I am getting an error indicating that folder & filename is not accessible. ( Invalid file path).

When I check on the server using the file path, I am able to see the files of C1 but why is it that the web program can't access the same.

Here is the code I am using.

 Dim sOCRInputFilePath As String = objConfig.FetchOCRSourcePath() & WorkOrderNumber.Text & ".pdf"
                   
If My.Computer.FileSystem.FileExists(sShareFilePath) Then
                        'Copy the files from OCRReady folder to the Server folder.
                        My.Computer.FileSystem.MoveFile(
                       sShareFilePath,
                        sOCRInputFilePath,
                        Microsoft.VisualBasic.FileIO.UIOption.AllDialogs,
                        Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing)
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

1. Can you manually navigate to the files and access them thru explorer?
2. In your code, are you attempting to access the local path or thru the share?
3. Can you dump the string stored in the variables:  sOCRInputFilePath & sShareFilePath?  To verify the value of the string...
4. What do the NTFS permissions look like?
5. How is the AppPool identity setup for the web application?

Dan
Avatar of Member_2_7967119
Member_2_7967119

ASKER

1.  Can you manually navigate to the files and access them thru explorer?  Yes both via the share and via the physically mapped drive to the shared folder.

2. In your code, are you attempting to access the local path or thru the share? Tried both, Intiialy mapped it to X Drive and also used \\IP Address of client system\ShareName

3. Can you dump the string stored in the variables:  sOCRInputFilePath & sShareFilePath?  To verify the value of the string...
sShareFilePath="\\10.0.0.127\OCRReady$\1_LCOTS.pdf"
sOCRInputFilePath="D:\Assets\"


4. What do the NTFS permissions look like? Logged in as Administrator.
5. How is the AppPool identity setup for the web application? LocalSystem.
So, the PDFs are on a share that is not local to the web server.  Several things are the issue.

1. your answer to #3 must be reversed.  Based on the posted code, the variable "sOCRInputFilePath" should contain a fully qualified file path.
2. your answer to #4 does not make sense.  My question pertains to the NTFS (File & Directory) permissions where the share is hosted.  Being logged in as Admin has nothing to do with the web application's access.
2a.  In addition, what are the share permissions on "OCRReady$?

What I believe is happening is that the AppPool setup up as LocalSystem, has no access/permission context on the share.  In order to access a share from a web application running in an AppPool under IIS, you need to run that AppPool's Identity with a service account.  Then that service account must have Share AND NTFS access to the files on the share.

Reference link:  https://www.iis.net/learn/manage/configuring-security/application-pool-identities

Dan
#1 : The sSharedPath is path to the client system which is a shared folder which is mapped on the server file system.

sShareFilePath="\\10.0.0.127\OCRReady$\1_LCOTS.pdf"
sOCRInputFilePath="D:\Assets\"

The req is that the files are stored in the client machine to the directory OCRReady (which resides on C drive of the client system). I want this folder to be accessible for the ASP.net website to acccess the folder and move the files to the D:\Assets folder on the server.

The permission for user for the shared folder  OCRReady$ is full control for allow.

I was reading on the google and it speak about articles on not able to recognise the mapped shared folder. I am still not able to understand why if I map a shared drive to  a physical path on the server, should n't the program treat the same as a physical drive?
ASKER CERTIFIED SOLUTION
Avatar of Dan McFadden
Dan McFadden
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
Thank you, Let me try.