?
Solved

Directory.Exists is not working

Posted on 2008-10-12
2
Medium Priority
?
629 Views
Last Modified: 2009-07-29
Hi,

  I have an ASP.net/C# application where I am trying to validate the existence of  folder with this format \\servername\foldername but the function Directory.Exists cannot find it, it works if I try to validate C:\ but not the one I need \\servername\folder

Hope you can help me
0
Comment
Question by:negreteo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 2000 total points
ID: 22697851
if you are trying to access the network name from an web site and if that website is running under aspnet credentials then your directory.exists will not work

following is the explanation
That's because you (the asp.net user) don't have any access rights to the share, note that the default account 'aspnet', doesn't even have network access rights. So you will have to impersonate a user with appropriate privileges to access the network share.
0
 

Author Comment

by:negreteo
ID: 22699714
Thanks following your advice I just added to Web.Config the next line and it worked

<identity impersonate="true" userName="domain\username" password="password"/>
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

719 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