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
Solved

Directory.Exists is not working

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

808 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