473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Accessing File and Folders on Network

Hi,
I'm experiencing a bit of a problem with security and file access from
within a ASP.Net application...

Locally (from an XP client) I manage to get any file or folder on my
machine with something similar to this:
DirectoryInfo di = new DirectoryInfo(strURL);
if(di.Exists)
{
FileInfo[] fileList = di.GetFiles();
//DirectoryInfo[] dirList = di.GetDirectories();
strDocURL = fileList[0].FullName;
Response.Redirect(strDocURL);
}
However when trying to access a network file/folder I get a security
exception and di.Exists is false. (System.UnauthorizedAccessException:
Access to the path "\\share\folder" is denied.)

The same code running from one of our W2K servers is able to open
network files just by having changed the following:
Response.Redirect("file:" + strDocURL);
However it isn't able to open folders (even without the "file:" bit).

I have set <identity impersonate="true" /> in the Web.config file.

-1 How can I keep the user credentials through out the application?
-2 Is there an alternative way to Response.Redirect for opening a
file/folder from within a browser?

Thanks
Rosa
Nov 15 '05 #1
5 4774
This is quite complex, you need to look into delegation. Check out this
article:

http://support.microsoft.com/?id=810572
Arild

"Rosa" <Ro**********@hotmail.com> wrote in message
news:39**************************@posting.google.c om...
Hi,
I'm experiencing a bit of a problem with security and file access from
within a ASP.Net application...

Locally (from an XP client) I manage to get any file or folder on my
machine with something similar to this:
DirectoryInfo di = new DirectoryInfo(strURL);
if(di.Exists)
{
FileInfo[] fileList = di.GetFiles();
//DirectoryInfo[] dirList = di.GetDirectories();
strDocURL = fileList[0].FullName;
Response.Redirect(strDocURL);
}
However when trying to access a network file/folder I get a security
exception and di.Exists is false. (System.UnauthorizedAccessException:
Access to the path "\\share\folder" is denied.)

The same code running from one of our W2K servers is able to open
network files just by having changed the following:
Response.Redirect("file:" + strDocURL);
However it isn't able to open folders (even without the "file:" bit).

I have set <identity impersonate="true" /> in the Web.config file.

-1 How can I keep the user credentials through out the application?
-2 Is there an alternative way to Response.Redirect for opening a
file/folder from within a browser?

Thanks
Rosa

Nov 15 '05 #2
Arild,
Thanks for the article.
Our servers are set to use Kerberos and the browsers are set to
"Enable Integrated Windows Authentication". IIS is set to "Windows
Authentication".

I guess I need to find out if the AD and the Computers are configured
for delegation...

Will keep you posted.

Thanks
Rosa
Nov 15 '05 #3
"Rosa" <Ro**********@hotmail.com> wrote in message
news:39**************************@posting.google.c om...
Arild,
Thanks for the article.
Our servers are set to use Kerberos and the browsers are set to
"Enable Integrated Windows Authentication". IIS is set to "Windows
Authentication".

I guess I need to find out if the AD and the Computers are configured
for delegation...

Will keep you posted.

Thanks
Rosa


By default, no computers or users are enabled for delegation, so that is
probably where your stuck right now.
Arild
Nov 15 '05 #4
Hi Arild,
Yep that is the case. We enabled delegation for my account and I can
now access any folder on the network (as long as the app is running on
my own machine's IIS).
However the credentials still get lost when I run it on the server:
- Would I need to enable delegation on the ASPNET user or on the
actual server itself?

Thanks
Rosa
By default, no computers or users are enabled for delegation, so that is
probably where your stuck right now.
Arild

Nov 15 '05 #5
Hmm... I'm not sure. Since it works on your computer, there must be some
differences on the configuration of the computer account or the IIS setup on
the two. Try giving the ASPNET user the "Act as part of the operating
system" privilege and/or make sure the webserver is trusted for delegation.
Arild

"Rosa" <Ro**********@hotmail.com> wrote in message
news:39**************************@posting.google.c om...
Hi Arild,
Yep that is the case. We enabled delegation for my account and I can
now access any folder on the network (as long as the app is running on
my own machine's IIS).
However the credentials still get lost when I run it on the server:
- Would I need to enable delegation on the ASPNET user or on the
actual server itself?

Thanks
Rosa
By default, no computers or users are enabled for delegation, so that is
probably where your stuck right now.
Arild

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
by: Thomas | last post by:
after spending countless hours trying, i give up and hope to get some help in here. on server1 i got the web myweb.com with my test.asp. in the test.asp, i'm trying to read a file from an UNC...
5
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a...
1
by: Z0gS | last post by:
I got this problem for the web application I try to access files on a remote server. string dirs = Directory.GetDirectories(@"E:\vehicles") E drive is a map to a network drive. I get the...
1
by: EMW | last post by:
Hi, I've build a webpage that is running on an intranet network. I've been asked to put links on the page to folders elsewere in the network and on another server. How can I do this? rg,...
2
by: Ian Murrell | last post by:
My application writes a text data file to a folder on another computer. The other computer is mapped by drive letter to the root (C) shared folder, eg as G:. The network is simple peer2peer, shared...
5
by: Khalique | last post by:
Hi everyone, I Hope that someone will be able to give me a hint to the solution to my problem. I have developed a web service (vb.net) that needs to access the folders / files and copy files to...
4
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For...
6
by: eswanson | last post by:
on a different server. I am currently getting an access denied when I attempt to do the following in my asp.net page: strFilePath = ConfigurationManager.AppSettings; strFileName =...
0
by: Ronnie1987 | last post by:
Hi, I am currently using FolderBrowserDialog class to access folders across the network. My problem is that when i click a folder, the Windows Authentication dialog does not appear and sub-folders...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.