user1019042
user1019042

Reputation: 2218

I can't access unc path from C#. Getting access is denied

I'm using Windows Server 2008 and IIS 7.5 I'm trying to access a file this way: \server\C$\temp\testFile.log from C# code running on another server.

My username is an admin on both servers. The code is running under that account. The temp folder has been set to full rights for (my user) and ASP.NET.

Why can't I access it?

I can't do a shared folder; against the rules. I am already running under full account; therefore, I don't need to do impersonation, right?

Upvotes: 1

Views: 9839

Answers (3)

AnotherDeveloper
AnotherDeveloper

Reputation: 1272

Is this a web app? Are you sure the app is impersonating your account? Is anonymous access set to true in IIS?

Upvotes: 1

Adriano Carneiro
Adriano Carneiro

Reputation: 58595

Had this very same problem a while ago.

For your debug process to run with full Admin access, you'd have to open Visual Studio with full admin access.

In production, have your process "Run As Administrator".

If you do not do any of the above, you will have to implement impersonation.

Upvotes: 3

Related Questions