File.Exists not working.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George Lake

    #1

    File.Exists not working.

    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.t xt") Then



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

    Any ideas why this is not working?







  • Herfried K. Wagner [MVP]

    #2
    Re: File.Exists not working.

    "George Lake" <g@lake.comschr ieb:
    >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.t xt") Then
    >
    >Where "O:\DTX Import UMAR\AsTester.t xt" 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/>

    Comment

    • George Lake

      #3
      Re: File.Exists not working.

      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.atwrot e in message
      news:eo61gG6nGH A.2312@TK2MSFTN GP04.phx.gbl...
      "George Lake" <g@lake.comschr ieb:
      >>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.t xt") Then
      >>
      >>Where "O:\DTX Import UMAR\AsTester.t xt" 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/>
      >

      Comment

      • Andrew Morton

        #4
        Re: File.Exists not working.

        George Lake wrote:
        >>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.t xt") Then
        >>>
        >>Where "O:\DTX Import UMAR\AsTester.t xt" is a network path.
        >>>
        >>Any ideas why this is not working?
        >>
        >Documentatio n:
        >>
        >>*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


        Comment

        • Michael D. Ober

          #5
          Re: File.Exists not working.


          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.comwrot e in message
          news:%23WM8CX6n GHA.4604@TK2MSF TNGP02.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.atwrot e in message
          news:eo61gG6nGH A.2312@TK2MSFTN GP04.phx.gbl...
          "George Lake" <g@lake.comschr ieb:
          >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.t xt") Then
          >
          >Where "O:\DTX Import UMAR\AsTester.t xt" 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/>
          >
          >
          >


          Comment

          • George Lake

            #6
            Re: File.Exists not working.

            It´s a domain user that has admin rights on the target server.

            "Michael D. Ober" <obermd.@.alum. mit.edu.nospamw rote in message
            news:u%23OecEDo GHA.1592@TK2MSF TNGP04.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.comwrot e in message
            news:%23WM8CX6n GHA.4604@TK2MSF TNGP02.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.atwrot e in message
            >news:eo61gG6nG HA.2312@TK2MSFT NGP04.phx.gbl.. .
            "George Lake" <g@lake.comschr ieb:
            >>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.t xt") Then
            >>
            >>Where "O:\DTX Import UMAR\AsTester.t xt" 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/>
            >
            >>
            >>
            >>
            >
            >
            >

            Comment

            • Jim Wooley

              #7
              Re: File.Exists not working.

              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

              It´s a domain user that has admin rights on the target server.
              >
              "Michael D. Ober" <obermd.@.alum. mit.edu.nospamw rote in message
              news:u%23OecEDo GHA.1592@TK2MSF TNGP04.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.t xt") Then
              >>>>Where "O:\DTX Import UMAR\AsTester.t xt" is a network path.

              Comment

              • George Lake

                #8
                Re: File.Exists not working.

                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

                "Jim Wooley" <jimNOSPAMwoole y@hotmail.comwr ote in message
                news:24f81e8f4c 798c86e5e4f0b23 29@msnews.micro soft.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

                >
                >It´s a domain user that has admin rights on the target server.
                >>
                >"Michael D. Ober" <obermd.@.alum. mit.edu.nospamw rote in message
                >news:u%23OecED oGHA.1592@TK2MS FTNGP04.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.t xt") Then
                >>>>>Where "O:\DTX Import UMAR\AsTester.t xt" is a network path.
                >
                >

                Comment

                Working...