Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

System.UnauthorizedAccessException : Access to the path '\\computername\content\happy\abc.jpg' is denied.

$
0
0

Hello,

i created a .NET web application which access file from a network path \\computername\content\happy\ and save new file or replace existing one. All works perfectly in local machine, but when i deploy them IIS 7,  it asks for credentials when trying to save file. I tried with several different methods. Thsi save file method is in fileupload.ashx ( handler).

  file.SaveAs(fileName.ToLower());

1) setting application pool to classic mode from integrated mode - did not work

2) seeting application pool to netowrk service, applicationPoolIdentity, also different configured user account who has read/write permission on those n/w path.

We checked everything, all looks good but still it is not working. Any idea? I already spent 3 days on it, but I am goign no where.

One this worked is providing configured user account information in <identity impersonation = true username ="hello" password="hello" />

but if i do so, i dont get particular username which I have to display in welcome note like HELLO JOHN, I have used following code to get user name. And password chaanges in every 90 days so this method looks inefficient too.

  WindowsIdentity winID = WindowsIdentity.GetCurrent();

                WindowsPrincipal winPrincipal = newWindowsPrincipal(winID);

                    userName = winPrincipal.Identity.Name;

 

 


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>