Regarding {system.unauthorizedAccessException} on Asp.net

I am trying to access files in the backup server from primary server by asp.net
And then I got next exception
{system.unauthorizedAccessException}
{"Access to the path \"\\\\10.8.8.155\\anka\\eyeroute\\prod\\v50x\\studies\\tn\\600000\\400002\\20041009\\800031\\300140\" is denied." }

My code is very simple as bellow:
DirectoryInfo di = new DirectoryInfo(uri);
FileInfo[] fi = di.GetFiles("*.jpg");

How to resolve this problem?
Thanks,
                                    
young_nacsAsked:
Who is Participating?
 
RomanPetrenkoConnect With a Mentor Commented:
You need permissions to this folder.
BTW, You can use @ sign to avoid doubling of \ character in path.
instead of
"\\\\10.8.8.155\\anka\\eyeroute\\prod\\v50x\\studies\\tn\\600000\\400002\\20041009\\800031\\300140\"
you write
@"\\10.8.8.155\anka\eyeroute\prod\v50x\studies\tn\600000\400002\20041009\800031\300140\"

Pay attention that in error message last \ is not doubled - may be here is the problem?
0
 
rajaloysiousCommented:
This may be of help..
I guess you may need to give access permissions to the particular folder for the aspnet account or whatever(which is used by asp)

cheers
0
 
young_nacsAuthor Commented:
No answer found yet.
But thanks for the comment anyway.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.