C# and file access permission failures on Windows 2000
-
First off I'm new to this development platform so I don't know some of the most obvious fixes for known problems. Anyway, I've developed an application in C# that creates/accesses text files and utilizes the Microsoft Access database. My application runs fine on XP but fails with file access permission failures on Windows 2000 professional (the only other platform I've had access to to try). The .Net framework 1.1 is loaded on the machine and the application comes up with no problems. Only when I try to access a file I start having problems. Is there someting obvious I'm missing? Something particular to Windows 2000 I need to understand? I can't be the only one who has had this problem....can I? Any help/insight would be appreciated. Parrish
-
First off I'm new to this development platform so I don't know some of the most obvious fixes for known problems. Anyway, I've developed an application in C# that creates/accesses text files and utilizes the Microsoft Access database. My application runs fine on XP but fails with file access permission failures on Windows 2000 professional (the only other platform I've had access to to try). The .Net framework 1.1 is loaded on the machine and the application comes up with no problems. Only when I try to access a file I start having problems. Is there someting obvious I'm missing? Something particular to Windows 2000 I need to understand? I can't be the only one who has had this problem....can I? Any help/insight would be appreciated. Parrish
Is your app running on the 2000 machine loaded from a network share on the XP machine? If so, that's where your problem is. Since the netowkr machine isn't a trusted server, your code will not have the same access to the system as if it were launched from the 2000 box. RageInTheMachine9532 "...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
-
First off I'm new to this development platform so I don't know some of the most obvious fixes for known problems. Anyway, I've developed an application in C# that creates/accesses text files and utilizes the Microsoft Access database. My application runs fine on XP but fails with file access permission failures on Windows 2000 professional (the only other platform I've had access to to try). The .Net framework 1.1 is loaded on the machine and the application comes up with no problems. Only when I try to access a file I start having problems. Is there someting obvious I'm missing? Something particular to Windows 2000 I need to understand? I can't be the only one who has had this problem....can I? Any help/insight would be appreciated. Parrish
Also (regarding what Dave said), the file permissions may be different. If your MDB (Jet Database, aka "Access database") is in a directory where you don't have write permissions, then you must change the permissions on that directory. If you're accessing the file over the network, then your code must have a
FileIOPermission
that allows access to that resource. This deals with Code Access Security in .NET - a sandbox of sorts that makes it a secure framework. See the article, Understanding .NET Code Access Security[^], for more information.Microsoft MVP, Visual C# My Articles
-
Is your app running on the 2000 machine loaded from a network share on the XP machine? If so, that's where your problem is. Since the netowkr machine isn't a trusted server, your code will not have the same access to the system as if it were launched from the 2000 box. RageInTheMachine9532 "...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
-
Also (regarding what Dave said), the file permissions may be different. If your MDB (Jet Database, aka "Access database") is in a directory where you don't have write permissions, then you must change the permissions on that directory. If you're accessing the file over the network, then your code must have a
FileIOPermission
that allows access to that resource. This deals with Code Access Security in .NET - a sandbox of sorts that makes it a secure framework. See the article, Understanding .NET Code Access Security[^], for more information.Microsoft MVP, Visual C# My Articles