开发者

How can I access a networked drive via the Web?

We have around 2000 staff. Each has a shared drive to store some of their files. This shared dr开发者_开发技巧ive points to a central location on our network.

Example:

John's F: drive -> \\ournetwork\john.doe

Jane's F: drive -> \\ournetwork\jane.doe

Each user will have a folder within the root "ournetwork" labeled with their username. I do not have to worry about the directory creation as that's already done for me. These users are all tied into our AD for authentication. Folder name == AD username.

We would like the ability to allow our users to access their mapped "F" drive from outside our network through a web page. I understand that the programming involved (assuming it comes to that) will not rely on their mapped drive but rather the UNC path as posted above.

I am open to suggestions on how to get this accomplished. ASP.NET? Is there just an IIS solution like WebDAV? (although client-side WebDAV on win 7 seems to be broken, so that may be off the table). Something else?

Thanks.


You specify the name of the file on the network just like you do from anywhere else:

Dim myStream As IO.FileStream = IO.File.Open("\\myserver\myshare\myfile", IO.FileMode.Open)
Dim myBytes As Byte()
myStream.Read(myBytes, 0, numberOfBytesToRead)

The tricky part is making sure that you access the file as an account that has access. Normally, ASP.net code runs as an 'anonymous' or 'system' account with limited priviliges. You need to specify that the ASP.net page run as a certain user with access to the file. Then, you need to enable impersonation in your web.config file in order for ASP.net to actually access the file as that user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜