| .NET DotNet Forum Index » VB.NET Forum (Visual Basic .NET) » System.IO.File.Exists in Windows 7... |
|
Page 1 of 1 |
|
| Author |
Message |
| vovan... |
Posted: Fri Oct 30, 2009 6:14 pm |
|
|
|
Guest
|
My VB 2008 application uses System.IO.File.Exists method. On XP there is no
problem with accessing file located on the server. On Windows 7 the file is
not found.
The same problem with
file_reader = New System.IO.StreamReader(strSourse & "\InitialData.txt")
where strSource is the string containing the path to the file on the server.
Any advice please.
Thank you
vovan |
|
|
| Back to top |
|
|
|
| Family Tree Mike... |
Posted: Fri Oct 30, 2009 6:47 pm |
|
|
|
Guest
|
vovan wrote:
Quote: My VB 2008 application uses System.IO.File.Exists method. On XP there is
no problem with accessing file located on the server. On Windows 7 the
file is not found.
The same problem with
file_reader = New System.IO.StreamReader(strSourse & "\InitialData.txt")
where strSource is the string containing the path to the file on the
server.
Any advice please.
Thank you
vovan
More than likely you are seeing folder virtualization for the first
time. It did not exist in XP. Where is strSourse pointing?
--
Mike |
|
|
| Back to top |
|
|
|
| Mr. Arnold... |
Posted: Fri Oct 30, 2009 7:17 pm |
|
|
|
Guest
|
"vovan" <vcha at (no spam) hotmail.com> wrote in message
news:9B6BB817-8023-4420-B47B-3A4675044A1F at (no spam) microsoft.com...
Quote: My VB 2008 application uses System.IO.File.Exists method. On XP there is
no problem with accessing file located on the server. On Windows 7 the
file is not found.
The same problem with
file_reader = New System.IO.StreamReader(strSourse & "\InitialData.txt")
where strSource is the string containing the path to the file on the
server.
Unlike XP, Vista and Windows 7 are not going to allow file access to
protected areas.
Where is the file located?
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4559 (20091030) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com |
|
|
| Back to top |
|
|
|
| vovan... |
Posted: Sat Oct 31, 2009 6:11 am |
|
|
|
Guest
|
What does it mean "folder virtualization"? The file exists in reality on the
server in the location
"\\192.168.45.13\CoordData\InitialData.txt"
My program sees it and can read when it is running on XP. I can see the file
via Windows Explorer as well on both Windows XP and Windows 7.
Thank you
vovan
"Family Tree Mike" <FamilyTreeMike at (no spam) ThisOldHouse.com> wrote in message
news:eWAO3OcWKHA.3404 at (no spam) TK2MSFTNGP05.phx.gbl...
Quote: vovan wrote:
My VB 2008 application uses System.IO.File.Exists method. On XP there is
no problem with accessing file located on the server. On Windows 7 the
file is not found.
The same problem with
file_reader = New System.IO.StreamReader(strSourse & "\InitialData.txt")
where strSource is the string containing the path to the file on the
server.
Any advice please.
Thank you
vovan
More than likely you are seeing folder virtualization for the first time.
It did not exist in XP. Where is strSourse pointing?
--
Mike |
|
|
| Back to top |
|
|
|
| Family Tree Mike... |
Posted: Sat Oct 31, 2009 6:35 am |
|
|
|
Guest
|
vovan wrote:
Quote: What does it mean "folder virtualization"? The file exists in reality on
the server in the location
"\\192.168.45.13\CoordData\InitialData.txt"
My program sees it and can read when it is running on XP. I can see the
file via Windows Explorer as well on both Windows XP and Windows 7.
Thank you
vovan
Virtualization is the name for the thing that Mr. Arnold was describing
as well. It protects certain folders like Program Files and My
Documents, which is where I might have expected your file to reside.
This only affects certain locations on your local machine, so it does
not come into play in your scenario.
Since it is a remote file that you know exists, it must be a permissions
problem. I would have thought this would through an exception if you
did not have permission to reach a file on the net. Are you running a
windows forms application, or is this a windows service? Services also
run differently, with different permissions on the newest OS's.
--
Mike |
|
|
| Back to top |
|
|
|
| vovan... |
Posted: Sat Oct 31, 2009 12:19 pm |
|
|
|
Guest
|
It is Windows Form application.
I've already read about permissions and tried this:
objPermission = New
System.Security.Permissions.FileIOPermission(Security.Permissions.PermissionState.Unrestricted,
strSourse & "\InitialData.txt")
objPermission.Demand()
It did not sove my problem. Unfortunately I cannot find any example showing
how to get permissions.
I also do not understand who should have a permission - my application or my
computer, and who may give that permission - the server or my application or
something else.
From the example I found and used (see above) it most likely that my
application gives the permission to itself. If the code is correct in
general (I do not know why it doesn't work) then for me it is nonsense - to
give a permission to itself.
Anyway, I still need a help.
Thank you
vovan
"Family Tree Mike" <FamilyTreeMike at (no spam) ThisOldHouse.com> wrote in message
news:ekvMQaiWKHA.1792 at (no spam) TK2MSFTNGP04.phx.gbl...
Quote: vovan wrote:
What does it mean "folder virtualization"? The file exists in reality on
the server in the location
"\\192.168.45.13\CoordData\InitialData.txt"
My program sees it and can read when it is running on XP. I can see the
file via Windows Explorer as well on both Windows XP and Windows 7.
Thank you
vovan
Virtualization is the name for the thing that Mr. Arnold was describing as
well. It protects certain folders like Program Files and My Documents,
which is where I might have expected your file to reside. This only
affects certain locations on your local machine, so it does not come into
play in your scenario.
Since it is a remote file that you know exists, it must be a permissions
problem. I would have thought this would through an exception if you did
not have permission to reach a file on the net. Are you running a windows
forms application, or is this a windows service? Services also run
differently, with different permissions on the newest OS's.
--
Mike |
|
|
| Back to top |
|
|
|
| Mr. Arnold... |
Posted: Sat Oct 31, 2009 12:35 pm |
|
|
|
Guest
|
vovan wrote:
Quote: It is Windows Form application.
I've already read about permissions and tried this:
objPermission = New
System.Security.Permissions.FileIOPermission(Security.Permissions.PermissionState.Unrestricted,
strSourse & "\InitialData.txt")
objPermission.Demand()
It did not sove my problem. Unfortunately I cannot find any example
showing how to get permissions.
I also do not understand who should have a permission - my application
or my computer, and who may give that permission - the server or my
application or something else.
From the example I found and used (see above) it most likely that my
application gives the permission to itself. If the code is correct in
general (I do not know why it doesn't work) then for me it is nonsense -
to give a permission to itself.
Anyway, I still need a help.
Maybe, you should put the file in a FileShare and give access to the
Fileshare to Everyone group.
A program is going to have the the file access rights of the user
account that's running the application. |
|
|
| Back to top |
|
|
|
| Patrice... |
Posted: Sat Oct 31, 2009 2:49 pm |
|
|
|
Guest
|
My approach would be to start from the root . I.e. do you see the container
folder ? also what if you are using the computer name rather than the IP
address ? What if you map a drive to this network share and see if you can
see enumerate files in this folder ?
Hopefully it should allow to narrow down the problem (you don't have any
message, it just return false ?)...
--
Patrice |
|
|
| Back to top |
|
|
|
| vovan... |
Posted: Mon Nov 02, 2009 10:01 am |
|
|
|
Guest
|
The same problem when I use computer name instead of IP.
The same problem if I put the file in the root.
If I create a mapped drive then it works. But it is not a solution. My
clients do not want to have mapped drives on users workstations.
I'm still looking for working example of Permission object
Thank you
vovan
"Patrice" <http://scribe-en.blogspot.com/> wrote in message
news:ulQIsumWKHA.5368 at (no spam) TK2MSFTNGP02.phx.gbl...
Quote: My approach would be to start from the root . I.e. do you see the
container folder ? also what if you are using the computer name rather
than the IP address ? What if you map a drive to this network share and
see if you can see enumerate files in this folder ?
Hopefully it should allow to narrow down the problem (you don't have any
message, it just return false ?)...
--
Patrice |
|
|
| Back to top |
|
|
|
|