I have an image in one of my folders, using webclient i am trying to download the image.
using (WebClient webClient = new WebClient())
{
webClient.DownloadFile(SessionManager.Current.ImagePath,SessionManager.Current.ImageName);
}
Here SessionManager.Current.ImagePath
has something like
"D:\\TFS\\MyProject\\MyProject1.5\\07 Construction\\01 SourceCode\\.NET\\MyProject1.5\\PanelImages\\20\\636403789911551848.PNG"
But all i get is an exception saying the folder is not accessible with the following message.
System.UnauthorizedAccessException: Access to the path 'C:\Program Files (x86)\IIS Express\636403764977345693.PNG' is denied.
I even tried unchecking the readonly
for the PanelImages
folder in vain(It keeps reverting back to readonly
).
I wonder why it is accessing Program Files (x86)\IIS Express\
when the path i provided is different?
can someone tell me wheere i might be going wrong?