Re: Can't determine if a file exists

From: Nicole Calinoiu (calinoiu)
Date: 08/12/05


Date: Fri, 12 Aug 2005 07:40:07 -0400


"Nikolai Evseev" <NikolaiEvseev@discussions.microsoft.com> wrote in message
news:47F77CB0-98A8-4497-8EB3-CA3E5BB128D5@microsoft.com...
> Hi there,
>
> I am usign System.IO.File.Exists in my ASP.NET code to determine if a file
> exists in the specified location. The webserver is my local machine, which
> is
> a part of the corporate domain. The file the existence of which I am
> trying
> to determine is sitting in the shared folder of the PC which is not a part
> of
> the corporate domain. If the Authenitcation on my webserver allows
> Anonymous
> user to logon then Exists method returns false (I take it happens because
> my
> anonymous user doesn't have access to that shared folder, since it's not a
> part of the domain).

Since ASP.NET is supposedly running on the same machine as the target
folder, the domain issue shouldn't be relevant for the anonymous scenario.
Are you using a local path to attempt to access the file (e.g.:
"c:\somefolder\somefile.txt" instead of
\\yourmachine\sharename\somefile.txt)? If so, you'll need to grant at least
the "List Folder/Read Data" permission on the folder containing the file to
the user account under which your application is running. (If you haven't
fiddled with the ASP.NET process account or impersonation settings, this
will be the ASPNET user on Windows XP when the application is using
anonymous access.) If you're not using a local path, try switching to that
instead.

> If I am using windows authentication then everything
> works fine, and I am able to see if the file exists in the shared folder.

Presumably because your account has permissions to the file.

> The
> last one, though, only works if I open the browser on the same PC where my
> webserver is running. But if I am logged on using the same user name and
> password on another PC then again Exists method always returns false.

Hmm... Now I'm starting to wonder if the "shared folder" is really local to
your PC or not. Could you please confirm if it's truly local to your PC or
if it's actually pointing to a share on another machine?

> I know it's a little confusing but still hoping that you can help me
> solving
> this problem
>
> Thanks



Relevant Pages

  • Cant determine if a file exists
    ... a part of the corporate domain. ... to determine is sitting in the shared folder of the PC which is not a part of ... If the Authenitcation on my webserver allows Anonymous ... anonymous user doesn't have access to that shared folder, ...
    (microsoft.public.dotnet.security)
  • Re: Cant determine if a file exists
    ... on which I am running the browser is also the ... Presume that PCDOM1 is in the corporate domain, and PCWKG is in it's own ... but how can I give access on a shared folder to the domain user if ... > Are you using a local path to attempt to access the file (e.g.: ...
    (microsoft.public.dotnet.security)
  • Re: Problem accessing user machine.
    ... shared folder on one client computer. ... Please ensure your domain account has shared permission and NTFS ... On the problematic client computer, right click the shared folder, ... click to check the "Hide All Microsoft ...
    (microsoft.public.windows.server.sbs)
  • Re: File sharing with blank password
    ... >advanced file sharing is being used, ... >local computer account or a domain account) and has been granted the Read, ... >You can be denied access to a Windows XP shared folder through the ... >the domain Guest account or the local Guest account has been enabled and ...
    (microsoft.public.windowsxp.network_web)
  • Re: File sharing with blank password
    ... In order to connect to a Windows XP Professional shared folder when ... advanced file sharing is being used, ... local computer account or a domain account) and has been granted the Read, ... You can be denied access to a Windows XP shared folder through the ...
    (microsoft.public.windowsxp.network_web)