Home All Groups Group Topic Archive Search About

File.Exists not working.

Author
4 Jul 2006 6:46 PM
George Lake
Now this is strange.
I had an app runing on W2K Pro and now that its on XP I cant find a file.

The code that is not working is:
If File.Exists("O:\DTX Import UMAR\AsTester.txt") Then



Where "O:\DTX Import UMAR\AsTester.txt" is a network path.

Any ideas why this is not working?

Author
4 Jul 2006 7:39 PM
Herfried K. Wagner [MVP]
"George Lake" <g@lake.com> schrieb:
>I had an app runing on W2K Pro and now that its on XP I cant find a file.
>
>The code that is not working is:
>If File.Exists("O:\DTX Import UMAR\AsTester.txt") Then
>
>Where "O:\DTX Import UMAR\AsTester.txt" is a network path.
>
>Any ideas why this is not working?

Documentation:

Show quoteHide quote
| *Return Value*
|     'true' if the caller has the required permissions and 'path'
|     contains the name of an existing file; otherwise, 'false'. This
|     method also returns 'false' if 'path' is a null reference
|     ('Nothing' in Visual Basic) or a zero-length string. If the
|     caller does not have sufficient permissions to read the specified
|     file, no exception is thrown and the method returns 'false'
|     regardless of the existence of 'path'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
4 Jul 2006 8:09 PM
George Lake
mmm
It should work then. The application is running under the same user as the
old server.
mmmm


Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:eo61gG6nGHA.2312@TK2MSFTNGP04.phx.gbl...
> "George Lake" <g@lake.com> schrieb:
>>I had an app runing on W2K Pro and now that its on XP I cant find a file.
>>
>>The code that is not working is:
>>If File.Exists("O:\DTX Import UMAR\AsTester.txt") Then
>>
>>Where "O:\DTX Import UMAR\AsTester.txt" is a network path.
>>
>>Any ideas why this is not working?
>
> Documentation:
>
> | *Return Value*
> |     'true' if the caller has the required permissions and 'path'
> |     contains the name of an existing file; otherwise, 'false'. This
> |     method also returns 'false' if 'path' is a null reference
> |     ('Nothing' in Visual Basic) or a zero-length string. If the
> |     caller does not have sufficient permissions to read the specified
> |     file, no exception is thrown and the method returns 'false'
> |     regardless of the existence of 'path'.
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
>
Author
5 Jul 2006 10:24 AM
Andrew Morton
George Lake wrote:
Show quoteHide quote
>>> I had an app runing on W2K Pro and now that its on XP I cant find a
>>> file. The code that is not working is:
>>> If File.Exists("O:\DTX Import UMAR\AsTester.txt") Then
>>>
>>> Where "O:\DTX Import UMAR\AsTester.txt" is a network path.
>>>
>>> Any ideas why this is not working?
>>
>> Documentation:
>>
>>> *Return Value*
>>>     'true' if the caller has the required permissions and 'path'
>>>     contains the name of an existing file; otherwise, 'false'. This

> It should work then. The application is running under the same user as
> the old server.

You can use filemon from www.sysinternals.com to see if it is really trying
to do what you want.

Andrew
Author
5 Jul 2006 12:45 PM
Michael D. Ober
What user?  If it is "system", then XP won't let the network IO succeed.
This is one of the security changes from W2K to XP.

Mike Ober.

Show quoteHide quote
"George Lake" <g@lake.com> wrote in message
news:%23WM8CX6nGHA.4604@TK2MSFTNGP02.phx.gbl...
>
> mmm
> It should work then. The application is running under the same user as the
> old server.
> mmmm
>
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
> news:eo61gG6nGHA.2312@TK2MSFTNGP04.phx.gbl...
> > "George Lake" <g@lake.com> schrieb:
> >>I had an app runing on W2K Pro and now that its on XP I cant find a
file.
> >>
> >>The code that is not working is:
> >>If File.Exists("O:\DTX Import UMAR\AsTester.txt") Then
> >>
> >>Where "O:\DTX Import UMAR\AsTester.txt" is a network path.
> >>
> >>Any ideas why this is not working?
> >
> > Documentation:
> >
> > | *Return Value*
> > |     'true' if the caller has the required permissions and 'path'
> > |     contains the name of an existing file; otherwise, 'false'. This
> > |     method also returns 'false' if 'path' is a null reference
> > |     ('Nothing' in Visual Basic) or a zero-length string. If the
> > |     caller does not have sufficient permissions to read the specified
> > |     file, no exception is thrown and the method returns 'false'
> > |     regardless of the existence of 'path'.
> >
> > --
> > M S   Herfried K. Wagner
> > M V P  <URL:http://dotnet.mvps.org/>
> > V B   <URL:http://classicvb.org/petition/>
> >
>
>
>
Author
5 Jul 2006 6:55 PM
George Lake
It´s a domain user that has admin rights on the target server.

Show quoteHide quote
"Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message
news:u%23OecEDoGHA.1592@TK2MSFTNGP04.phx.gbl...
>
> What user?  If it is "system", then XP won't let the network IO succeed.
> This is one of the security changes from W2K to XP.
>
> Mike Ober.
>
> "George Lake" <g@lake.com> wrote in message
> news:%23WM8CX6nGHA.4604@TK2MSFTNGP02.phx.gbl...
>>
>> mmm
>> It should work then. The application is running under the same user as
>> the
>> old server.
>> mmmm
>>
>>
>> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
>> news:eo61gG6nGHA.2312@TK2MSFTNGP04.phx.gbl...
>> > "George Lake" <g@lake.com> schrieb:
>> >>I had an app runing on W2K Pro and now that its on XP I cant find a
> file.
>> >>
>> >>The code that is not working is:
>> >>If File.Exists("O:\DTX Import UMAR\AsTester.txt") Then
>> >>
>> >>Where "O:\DTX Import UMAR\AsTester.txt" is a network path.
>> >>
>> >>Any ideas why this is not working?
>> >
>> > Documentation:
>> >
>> > | *Return Value*
>> > |     'true' if the caller has the required permissions and 'path'
>> > |     contains the name of an existing file; otherwise, 'false'. This
>> > |     method also returns 'false' if 'path' is a null reference
>> > |     ('Nothing' in Visual Basic) or a zero-length string. If the
>> > |     caller does not have sufficient permissions to read the specified
>> > |     file, no exception is thrown and the method returns 'false'
>> > |     regardless of the existence of 'path'.
>> >
>> > --
>> > M S   Herfried K. Wagner
>> > M V P  <URL:http://dotnet.mvps.org/>
>> > V B   <URL:http://classicvb.org/petition/>
>> >
>>
>>
>>
>
>
>
Author
5 Jul 2006 7:24 PM
Jim Wooley
Does the user have the O drive mapped to the correct network share? Also,
can the user browse to that file manually and open it?
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx

Show quoteHide quote
> It´s a domain user that has admin rights on the target server.
>
> "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message
> news:u%23OecEDoGHA.1592@TK2MSFTNGP04.phx.gbl...
>

>>>>> I had an app runing on W2K Pro and now that its on XP I cant find
>>>>> a
>>>>>
>> file.
>>
>>>>> The code that is not working is:
>>>>> If File.Exists("O:\DTX Import UMAR\AsTester.txt") Then
>>>>> Where "O:\DTX Import UMAR\AsTester.txt" is a network path.
Author
5 Jul 2006 8:32 PM
George Lake
yes to both.
what beats me is that the same app runing under the same user works on win2k
Pro and not on XP pro

Show quoteHide quote
"Jim Wooley" <jimNOSPAMwooley@hotmail.com> wrote in message
news:24f81e8f4c798c86e5e4f0b2329@msnews.microsoft.com...
> Does the user have the O drive mapped to the correct network share? Also,
> can the user browse to that file manually and open it?
> Jim Wooley
> http://devauthority.com/blogs/jwooley/default.aspx
>
>> It´s a domain user that has admin rights on the target server.
>>
>> "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message
>> news:u%23OecEDoGHA.1592@TK2MSFTNGP04.phx.gbl...
>>
>
>>>>>> I had an app runing on W2K Pro and now that its on XP I cant find
>>>>>> a
>>>>>>
>>> file.
>>>
>>>>>> The code that is not working is:
>>>>>> If File.Exists("O:\DTX Import UMAR\AsTester.txt") Then
>>>>>> Where "O:\DTX Import UMAR\AsTester.txt" is a network path.
>
>