473,804 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileIOPermissio n

When I compile the application and run it (on my computer) it works fine, by
on the other computers exception is thrown: "Request for the permission of
type 'System.Securit y.Permissions.F ileIOPermission , mscorlib,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9' failed."

Exception occurs at this: DirectoryInfo currentDir = new
DirectoryInfo(" C:\\");

What should I do to allow running this application on other computers than
mine ?
Dec 29 '06 #1
10 8693
Is the executable you are running on the other computers actually on that
machine or on a network drive? This can cause problems as the code is run
with less priveledges.

Luke
http://blog.lukesmith.net

"Emil" <em******@pl.pl wrote in message
news:en******** **@nemesis.news .tpi.pl...
When I compile the application and run it (on my computer) it works fine,
by on the other computers exception is thrown: "Request for the permission
of type 'System.Securit y.Permissions.F ileIOPermission , mscorlib,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
failed."

Exception occurs at this: DirectoryInfo currentDir = new
DirectoryInfo(" C:\\");

What should I do to allow running this application on other computers than
mine ?
Dec 30 '06 #2
The executable is ON that machine.

Emil
Uzytkownik "Luke Smith" <stuffNOSPAM@lu kesmithDOTnetna pisal w wiadomosci
news:D1******** *************** ***********@mic rosoft.com...
Is the executable you are running on the other computers actually on that
machine or on a network drive? This can cause problems as the code is run
with less priveledges.

Luke
http://blog.lukesmith.net

"Emil" <em******@pl.pl wrote in message
news:en******** **@nemesis.news .tpi.pl...
>When I compile the application and run it (on my computer) it works fine,
by on the other computers exception is thrown: "Request for the
permission of type 'System.Securit y.Permissions.F ileIOPermission ,
mscorlib, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken =b77a5c561934e0 89' failed."

Exception occurs at this: DirectoryInfo currentDir = new
DirectoryInfo( "C:\\");

What should I do to allow running this application on other computers
than mine ?

Dec 30 '06 #3
On Sat, 30 Dec 2006 00:46:02 +0100, Emil wrote:
When I compile the application and run it (on my computer) it works fine, by
on the other computers exception is thrown: "Request for the permission of
type 'System.Securit y.Permissions.F ileIOPermission , mscorlib,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9' failed."

Exception occurs at this: DirectoryInfo currentDir = new
DirectoryInfo(" C:\\");

What should I do to allow running this application on other computers than
mine ?
Maybe the account the application is running under in the other computers
does not have access to drive c:\
--
Bits.Bytes
http://bytes.thinkersroom.com
Dec 30 '06 #4
"Rad [Visual C# MVP]" <no****@nospam. comwrote in message
news:ua******** ******@thinkers room.com...
On Sat, 30 Dec 2006 00:46:02 +0100, Emil wrote:
>When I compile the application and run it (on my computer) it works fine, by
on the other computers exception is thrown: "Request for the permission of
type 'System.Securit y.Permissions.F ileIOPermission , mscorlib,
Version=2.0.0. 0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9' failed."

Exception occurs at this: DirectoryInfo currentDir = new
DirectoryInfo( "C:\\");

What should I do to allow running this application on other computers than
mine ?

Maybe the account the application is running under in the other computers
does not have access to drive c:\
--
Bits.Bytes
http://bytes.thinkersroom.com

Nope, this not a Windows access rights issue, it's a CAS error message. It means that the
"code" is loaded from a location that has no FileIOPermissio ns in it's permission-set, that
means it doesn't load from a local drive but from a "network" drive.

Willy.
Dec 30 '06 #5
"Emil" <em******@pl.pl wrote in message news:en******** **@atlantis.new s.tpi.pl...
The executable is ON that machine.
On WHAT machine, it's clear that the code is loaded from a *non* local drive, code that
loads from local drives run with full-trust, that means they have full IO access.

Willy.

Dec 30 '06 #6
Unless the CAS has been changed on the machines he's trying to run the exe
on so as to not give any code Full Trust (i've never delved into modifying
from the default settings installed).

If you're not the admin of the machines it could be worth asking the admin
if they have modified any of the .NET CAS settings in Control
Panel->Administrati ve Tools->Microsoft .NET Framework x.x Configuration.

Luke

"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:%2******** *******@TK2MSFT NGP03.phx.gbl.. .
"Emil" <em******@pl.pl wrote in message
news:en******** **@atlantis.new s.tpi.pl...
>The executable is ON that machine.

On WHAT machine, it's clear that the code is loaded from a *non* local
drive, code that loads from local drives run with full-trust, that means
they have full IO access.

Willy.
Dec 30 '06 #7
"Luke Smith" <stuffNOSPAM@lu kesmithDOTnetwr ote in message
news:02******** *************** ***********@mic rosoft.com...
Unless the CAS has been changed on the machines he's trying to run the exe on so as to not
give any code Full Trust (i've never delved into modifying from the default settings
installed).

If you're not the admin of the machines it could be worth asking the admin if they have
modified any of the .NET CAS settings in Control Panel->Administrati ve Tools->Microsoft
.NET Framework x.x Configuration.
IMO this is very unlikely, first the tool is no longer distributed with the V2.0 framework
(only included with the SDK or VS install), second , IMO the OP is the admin, do you think
he removed FIleIOPermissio ns from the fulltrust permission set?

Willy.

Dec 30 '06 #8

Uzytkownik "Willy Denoyette [MVP]" <wi************ *@telenet.benap isal w
wiadomosci news:uN******** ******@TK2MSFTN GP03.phx.gbl...
"Rad [Visual C# MVP]" <no****@nospam. comwrote in message
news:ua******** ******@thinkers room.com...
>On Sat, 30 Dec 2006 00:46:02 +0100, Emil wrote:
>>When I compile the application and run it (on my computer) it works
fine, by
on the other computers exception is thrown: "Request for the permission
of
type 'System.Securit y.Permissions.F ileIOPermission , mscorlib,
Version=2.0.0 .0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
failed."

Exception occurs at this: DirectoryInfo currentDir = new
DirectoryInfo ("C:\\");

What should I do to allow running this application on other computers
than
mine ?

Maybe the account the application is running under in the other computers
does not have access to drive c:\
--
Bits.Bytes
http://bytes.thinkersroom.com


Nope, this not a Windows access rights issue, it's a CAS error message. It
means that the "code" is loaded from a location that has no
FileIOPermissio ns in it's permission-set, that means it doesn't load from
a local drive but from a "network" drive.

Willy.

It's loaded from a local drive. I've simply created the application, copied
to usb flash disc, then copied it from usb flash disc to the local drive on
the other computer (with windows Xp installed, and user logged as an
administrator, and where Total Commander works fine with full access to
drive C:\). And when I try to run this application I get this error. It
happens on all computers except mine. I found a solution to add a
certificate or sign the application with some key but it's to complicated
for me.

Emil
Dec 30 '06 #9
OK, I've solved the problem.
The security exception really occured at this:
DriveInfo[] Drives = DriveInfo.GetDr ives();
foreach (disc in Drives) comboBox1.Items .Add (disc.Name);

I've changed it to:
for (int i=0;i<Directory .GetLogicalDriv es().Length;i++ )
comboBox1.Items .Add(Directory. GetLogicalDrive s()[i]);

and now it works fine. Notice that string[] drives =
DriveInfo.GetLo gicalDrives(); would also throw Security Exception. Why ? I
don't know ;)

thanks for help anyway
Użytkownik "Emil" <em******@pl.pl napisał w wiadomo¶ci
news:en******** **@nemesis.news .tpi.pl...
When I compile the application and run it (on my computer) it works fine,
by on the other computers exception is thrown: "Request for the permission
of type 'System.Securit y.Permissions.F ileIOPermission , mscorlib,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
failed."

Exception occurs at this: DirectoryInfo currentDir = new
DirectoryInfo(" C:\\");

What should I do to allow running this application on other computers than
mine ?

Dec 30 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1376
by: Mircea Pleteriu | last post by:
Hi all, I have this code sample FileIOPermission fp = new FileIOPermission(PermissionState.Unrestricted); fp.Deny(); StreamWriter sw = new StreamWriter(@"c:\test.txt");
0
3855
by: Ant Corrie | last post by:
I am at a loss as to why this is not working. I am trying to setup a TextWriterTraceListener in my application config file and then execute the app from the network. I get a security exception (listed below) even though I have StrongNamed my application and used the .NET Configuration Tool to create a Code Access Group in the Machine Policy that gives FullTrust to assemblies with the StrongName that I created. If you uncomment the code...
0
1733
by: paul | last post by:
I just installed Windows XP SP2 on my web server. Now when I run one of the web applications I get the following error: ArgumentException: Illegal characters in path.] System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String str) +276 System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, String pathListOrig, Boolean checkForDuplicates, Boolean
0
1135
by: John Delange | last post by:
Hello, I wrote a .NET Windows.Forms User Control that needs to be runned through Internet Explorer, like in this article: http://www.15seconds.com/issue/030610.htm. This control needs to 1.) Run on the Internet and 2.) have FileIOPermission... Is there a way of deployment where the final user (the user who's just surfing on the internet) doesn't have to set the FileIOPermission to the assembly manually? Like the way signed ActiveX...
6
2479
by: schaf | last post by:
Hi NG ! I have the following piece of code below. the first try/catch part would return true although I do not have permission to access this computer. The second try/catch part would return false. Do I misunderstand the meaning of FileIOPermission ? >From MSDN: "Controls the ability to access files and folders" ??? Thanks for education! Regards Marcel (Schaf)
1
2188
by: Marquis | last post by:
I have put the C# Form onito the Internet as an ActiveX Control. However, I cannot do the FileOpen Dialog as I don't have permission, how to solve this problem? Below is the error code: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at...
3
12064
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. (machine.config) ---> System.Security.SecurityException: Request for the permission of type
1
2798
by: innes | last post by:
Hi, I'm trying to test permission to access the file system, using FileIOPermission, but can't seem to get it to work. See my sample app below, for an app that tries to demand a permission to read a specified path, and then calls Directory.GetFiles on that path. The Demands on FileIOPermissions (I tried 3 variations) all work, and then when I call Directory.GetFiles an exception is thrown... saying
2
1416
by: Dave | last post by:
Yesterday I posted: **************************** I'm trying to download a file from the Web Server to the user's desktop using myWebClient.DownloadFile as described by Microsoft at http://msdn.microsoft.com/en-us/library/ez801hhe.aspx. 2 Questions:
1
9898
by: Oleg Subachev | last post by:
I try to write some info to file in the CLR Trigger under SQL Server 2005. But I get the following error: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. How can I grant FileIOPermission to my assembly running under SQL Server ? Oleg Subachev
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.