Wednesday, March 28, 2012

system.IO

code snippet:-
sFile = x:\test\abcd.mdb
if (System.IO.File.Exists(sFile))
//do something
else
//do something else
my code is failing at Exists function. It does not find the file.
X:\ is a mapped drive. X drive has domain account permissions (like
domain\myLoginaccount). also I am runing my web application with default
security as annonymus user called domain\myLoginaccount
Why the Exsits function does not find the file. Am I missing any permissions
here...whats the best mthod to access the files from another machine thru
asp.net
thanks
cheers !I think there are 2 potential hurdles here:
1. does the account running the web page have privileges to access the
share? Be aware that as well as the IIS user and IIS impersonation, you also
have to consider which user the asp.net worker process is running as. This
is quite a complex subject and I'm afraid my knowledge is limited to the
general concept.
2. does the web app actually have the drive mapped? the web server will not
inherit mapped drives from a terminal session so unless you are mapping the
drive from the web app, I don't tihnk it will be there. I would suggest you
try again with a unc path.
Andy
"abcd" <abcd@.abcd.com> wrote in message
news:eXNa%23BpoFHA.3912@.TK2MSFTNGP10.phx.gbl...
> code snippet:-
> sFile = x:\test\abcd.mdb
> if (System.IO.File.Exists(sFile))
> //do something
> else
> //do something else
> my code is failing at Exists function. It does not find the file.
> X:\ is a mapped drive. X drive has domain account permissions (like
> domain\myLoginaccount). also I am runing my web application with default
> security as annonymus user called domain\myLoginaccount
> Why the Exsits function does not find the file. Am I missing any
> permissions here...whats the best mthod to access the files from another
> machine thru asp.net
> thanks
> cheers !
>
>

0 comments:

Post a Comment