Click here to Skip to main content
15,908,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an ASP.NET website, that has to access a shared network drive. The shared network drive is on an EMC path or ECS. The management module for the shared drives is EMC made, accessible through a browser, so I am assuming.

In the web.config, I have the drive names as Z:, R: etc..

I am able to mount them on the cmd line with the following line. Otherwise, there is no windows access to VFS folder through the address bar or a browser.

mount -o xx.xx.xx.xx://vfs/folder_I_need_to_Access_to. Z:


I have modified the program's code, mounted the drives and am able to access the files while debugging the code, in the web browser. However, once I publish my code to the IIS server, the code does not seem to access the files and view them, even though the drive is mounted as a network drive and accessible through windows explorer. I have checked permissions on both EMC manager, Windows and IIS.

Some of my distant colleagues have said their teams ran into such issues and fixed them, however they have no idea what to do since they do not usually have logs or bugfixing documents, so I am assuming, mine is not an isolated case.

If you need more info on the subject, feel free to ask, I have scoured the internet and applied every solution by the way. Like NekoDrive, network utility libraries

tldr; The program deployed on IIS cant access the network shared folders under a vfs directory, while its owner and the debugged code on localhost is able to.

What I have tried:

adding the network folders to IIS as virtual directories does not work as well, however, I am able to access the files and folders through IIS manager content view, so I assume IIS is able to scan the directories and has appropriate permissions to the folders. Also, the user running the website is a domain admin and able to access directories as well.
Posted
Updated 31-Jan-18 2:14am

When you map / mount a network drive, that mapping only applies to your session.

IIS runs your application in a different session, as a different user. The code will not have access to any drives mapped under your session.

If the application pool user has permission to mount the VFS folder, you might be able to use Process.Start to run the mount command when your application starts. You'd also want to check System.IO.DriveInfo.GetDrives to see if it is already mounted.
 
Share this answer
 
Comments
EvsizTospaa 31-Jan-18 8:10am    
I have tried your solution, running a mount command in the runtime, however it did not work and I have no idea why. I have tried every logical solution I could but in the end, solution was rather simpler than I had imagined I will post the solution I came up with shortly. Thank you for taking the time.
I have finally solved the issue.

In case anyone else stumbles here,

Since mounting the drives was impossible, I have modified the web.config to have the IP address instead of the mounted drive's letter in IIS manager, Configuration Editor.

So instead of Z:\ , K:\ or F:\

now it says;

\\XX.XX.XX.XX\VFS\SHARED_FOLDER


and the download link is generated as follows, take note of the backslash and slashes

\\XX.XX.XX.XX\VFS\SHARED_FOLDER\file_path/file_path/file_name


Because it would clearly show the IP of the machine while the download link is hovered on, I am encrypting and decrypting the link variable during runtime.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900