Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Directory.Exists is not working

Posted on 2008-10-12
2
Medium Priority
?
631 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 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2
Suggested Courses

972 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