System.IO.File.Exists Method

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I'm building a program which allows users to upload files (located both
on their computer and on our network) onto a file server. However, it
appears that the Internet Guest Account on the webserver must have access to
every possible file location from-which the users are selecting files. If
this access is missing, an exception of type
System.UnauthorizedAccessException occurs.

Obviously its impractical for me to grant the Internet Guest Account access
for all possible network locations.

What should I do to workaround this delima? Is there a workaround?

Thanks!
 
Not sure what you are doing.

The user selects a file (so the user must have access obviously to the file
he want to select). Then server side you get the file content and you save
it were you wish (at a writable place). The server must have write access
only to this place.

For now it would look like if you tried to store those files at their
original location or something similar ?
 
Hello Patrice,

Thanks for your response. It turns out I need to turn "Identify
Impersonate=On". Doing this fixed my problem.
 
I think I know what Mike says.. the upload location is different each time,
and how to manage it you are saying... here is a idea..

Upload only to a certain location ( granted writes)
the remote machine runs a localized and authorized process that can move the
file on receive. Of course this process should be listening to receive files

HTH
VJ
 
Still look really weird. The server doesn't even access to "every possible
file location from which users are selecting files". Usually the user select
a file. The content is read by the browser (i.e. a client side program) and
sent to a server page that then reads the content (the server doesn't read
from the original location, it just reads what the browser sent).

Glad you solved the problem but you may want to explain what you are doing
as the behavior you have doesn't match the usual upload scheme and would let
me suspect some design problem.

Are you sure this is not a problem when you write the file server side
rather than when you read (how ?) the file in which case impersonation could
be overkill (you could have just granted the needed rights to the storage
location)...
 
Back
Top