Solved

Directory.Exists is not working

Posted on 2008-10-12
2
621 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get id from json Data with NewtonSoft 3 34
Why is some text in blue in Visual Studio? 6 24
how to read json value 2 31
Error in script 11 47
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

895 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

18 Experts available now in Live!

Get 1:1 Help Now