Solved

Directory.Exists is not working

Posted on 2008-10-12
2
620 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
2 Comments
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 500 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now