473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

FileIO Exception and permissions

Hello,

I am working on a project to manipulate XML files. All of the files,
the code, and the output are on network drives. When I run my program
I get an exception (see below). I tried giving the LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc. This had
no effect whatsoever. What do I need to do to fix this?

Thanks,

Jeremy
/************************************************
//Exception

Unhandled Exception: System.Security.SecurityException: Request for
the permissi
on of type 'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.
0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Obj ect demand,
StackCrawlMa
rk& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.DirectoryInfo..ctor(String path)
at TEILibrary.getFiles(String strFolderPath)
at TEIConsole.Program.Main(String[] args)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.FileIOPermissio n,
mscorlib, Vers
ion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Read="X:\xml\."/>

The demand was for:
<IPermission class="System.Security.Permissions.FileIOPermissio n,
mscorlib, Vers
ion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Read="X:\xml\."/>

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.FileDialogPermi ssion,
mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Access="Open"/>
<IPermission
class="System.Security.Permissions.IsolatedStorage FilePermission, m
scorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="ApplicationIsolationByUser"
UserQuota="512000"/>
<IPermission class="System.Security.Permissions.SecurityPermiss ion,
mscorlib, Ve
rsion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Execution"/>
<IPermission class="System.Security.Permissions.UIPermission,
mscorlib, Version=
2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="SafeTopLevelWindows"
Clipboard="OwnClipboard"/>
<IPermission class="System.Security.Permissions.UrlIdentityPerm ission,
mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Url="file:///X:/dev/TEIConsole/TEIConsole/bin/Release/TEIConsole.exe"/
>
<IPermission
class="System.Security.Permissions.ZoneIdentityPer mission, mscorlib
, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Zone="Trusted"/>
<IPermission class="System.Drawing.Printing.PrintingPermission,
System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="SafePrinting"/>
<IPermission class="System.Security.Permissions.MediaPermission ,
WindowsBase, Ve
rsion=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
version="1"
Audio="SafeAudio"
Video="SafeVideo"
Image="SafeImage"/>
<IPermission class="System.Security.Permissions.WebBrowserPermi ssion,
WindowsBas
e, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
version="1"
Level="Safe"/>
</PermissionSet>

The assembly or AppDomain that failed was:
TEIConsole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The method that caused the failure was:
System.Collections.ArrayList getFiles(System.String)
The Zone of the assembly that failed was:
Trusted
The Url of the assembly that failed was:
file:///X:/dev/TEIConsole/TEIConsole/bin/Release/TEIConsole.exe
/
************************************************** *********************

public ArrayList getFiles(String strFolderPath)
{
//create a directoryinfo object
DirectoryInfo objDirInfo = new DirectoryInfo(strFolderPath);

//get the FileInfo array
FileInfo[] arrFileInfo = objDirInfo.GetFiles();

ArrayList arrFiles = new ArrayList();

for (int i = 0; i < arrFileInfo.Length; i++)
{
arrFiles.Add(arrFileInfo[i].Name);
//arrFiles[i] = arrFileInfo[i].Name;
}

return arrFiles;
}

/
************************************************** ********************
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: C# Express

Microsoft Visual C# 2005 76544-000-0000011-00126
Microsoft Visual C# 2005

May 20 '07 #1
8 7677

<jp********@hotmail.comwrote in message
news:11**********************@n15g2000prd.googlegr oups.com...
Hello,

I am working on a project to manipulate XML files. All of the files,
the code, and the output are on network drives. When I run my program
I get an exception (see below). I tried giving the LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc. This had
no effect whatsoever. What do I need to do to fix this?
The XML files need to be on an accessible Network Share. It seems to me that
you simply have a permission issue with the User Account being ran on the
machine, which the program running under those User Account permissions will
have as permission rights. If this is a Web based solution, then the ASPNET
machine account may be coming into play as well.

May 20 '07 #2
On May 20, 5:39 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<jporter...@hotmail.comwrote in message

news:11**********************@n15g2000prd.googlegr oups.com...
Hello,
I am working on a project to manipulate XML files. All of the files,
the code, and the output are on network drives. When I run my program
I get an exception (see below). I tried giving the LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc. This had
no effect whatsoever. What do I need to do to fix this?

The XML files need to be on an accessible Network Share. It seems to me that
you simply have a permission issue with the User Account being ran on the
machine, which the program running under those User Account permissions will
have as permission rights. If this is a Web based solution, then the ASPNET
machine account may be coming into play as well.
I am running this as a console application under my domain user
account. The domain user account has Modify, Read & Execute, List
Folder Contents, Read, Write NTFS permissions. Everyone has Full
Control on share permissions. I can access all of the XML files for
reading/wrting under any text editor using my domain user account. I
don't think it is a simple file permissions issue in the operating
system--it has to be in .NET. Any ideas?

Thanks!

Jeremy

May 20 '07 #3
On May 20, 5:57 pm, jporter...@hotmail.com wrote:
On May 20, 5:39 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:


<jporter...@hotmail.comwrote in message
news:11**********************@n15g2000prd.googlegr oups.com...
Hello,
I am working on a project to manipulate XML files. All of the files,
the code, and the output are on network drives. When I run my program
I get an exception (see below). I tried giving the LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc. This had
no effect whatsoever. What do I need to do to fix this?
The XML files need to be on an accessible Network Share. It seems to me that
you simply have a permission issue with the User Account being ran on the
machine, which the program running under those User Account permissions will
have as permission rights. If this is a Web based solution, then the ASPNET
machine account may be coming into play as well.

I am running this as a console application under my domain user
account. The domain user account has Modify, Read & Execute, List
Folder Contents, Read, Write NTFS permissions. Everyone has Full
Control on share permissions. I can access all of the XML files for
reading/wrting under any text editor using my domain user account. I
don't think it is a simple file permissions issue in the operating
system--it has to be in .NET. Any ideas?

Thanks!

Jeremy- Hide quoted text -

- Show quoted text -
I forgot to mention that the program works when I copy and run it on
the local machine.

May 21 '07 #4

<jp********@hotmail.comwrote in message
news:11**********************@y18g2000prd.googlegr oups.com...
On May 20, 5:57 pm, jporter...@hotmail.com wrote:
>On May 20, 5:39 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:


<jporter...@hotmail.comwrote in message
>news:11**********************@n15g2000prd.googleg roups.com...
Hello,
I am working on a project to manipulate XML files. All of the files,
the code, and the output are on network drives. When I run my program
I get an exception (see below). I tried giving the LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc. This
had
no effect whatsoever. What do I need to do to fix this?
The XML files need to be on an accessible Network Share. It seems to me
that
you simply have a permission issue with the User Account being ran on
the
machine, which the program running under those User Account permissions
will
have as permission rights. If this is a Web based solution, then the
ASPNET
machine account may be coming into play as well.

I am running this as a console application under my domain user
account. The domain user account has Modify, Read & Execute, List
Folder Contents, Read, Write NTFS permissions. Everyone has Full
Control on share permissions. I can access all of the XML files for
reading/wrting under any text editor using my domain user account. I
don't think it is a simple file permissions issue in the operating
system--it has to be in .NET. Any ideas?

Thanks!

Jeremy- Hide quoted text -

- Show quoted text -

I forgot to mention that the program works when I copy and run it on
the local machine.
Your .Net Development machine as opposed to it being ran on a server, as an
example?

I would look at the .Net machine.config file. I know there is a .NET
utility to set application permission on a machine, but I don't remember the
name of the utility.

On your local machine, if that is your development machine, the program has
the .Net permissions, and when it's deployed to another machine it doesn't
have those permissions.

You may also want to look into setting a Domain Group Policy for .Net
applications.

May 21 '07 #5
On May 21, 7:11 am, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<jporter...@hotmail.comwrote in message

news:11**********************@y18g2000prd.googlegr oups.com...


On May 20, 5:57 pm, jporter...@hotmail.com wrote:
On May 20, 5:39 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<jporter...@hotmail.comwrote in message
news:11**********************@n15g2000prd.googlegr oups.com...
Hello,
I am working on a project to manipulate XML files. All of the files,
the code, and the output are on network drives. When I run my program
I get an exception (see below). I tried giving the LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc. This
had
no effect whatsoever. What do I need to do to fix this?
The XML files need to be on an accessible Network Share. It seems to me
that
you simply have a permission issue with the User Account being ran on
the
machine, which the program running under those User Account permissions
will
have as permission rights. If this is a Web based solution, then the
ASPNET
machine account may be coming into play as well.
I am running this as a console application under my domain user
account. The domain user account has Modify, Read & Execute, List
Folder Contents, Read, Write NTFS permissions. Everyone has Full
Control on share permissions. I can access all of the XML files for
reading/wrting under any text editor using my domain user account. I
don't think it is a simple file permissions issue in the operating
system--it has to be in .NET. Any ideas?
Thanks!
Jeremy- Hide quoted text -
- Show quoted text -
I forgot to mention that the program works when I copy and run it on
the local machine.

Your .Net Development machine as opposed to it being ran on a server, as an
example?

I would look at the .Net machine.config file. I know there is a .NET
utility to set application permission on a machine, but I don't remember the
name of the utility.

On your local machine, if that is your development machine, the program has
the .Net permissions, and when it's deployed to another machine it doesn't
have those permissions.

You may also want to look into setting a Domain Group Policy for .Net
applications.- Hide quoted text -

- Show quoted text -
Maybe I'm not explain this clearly. The program resides on a network
share and is run from the development machine on a network share. The
program is never run from any other computer. When it is run from the
network share it does not work. When I copy the program to a local
drive it works fine.

What domain policy would I set and what would that do exactly?

What am I looking for in Machine.Config?

Thanks for your help!

Jeremy

May 21 '07 #6
On May 21, 11:05 am, jporter...@hotmail.com wrote:
On May 21, 7:11 am, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:


<jporter...@hotmail.comwrote in message
news:11**********************@y18g2000prd.googlegr oups.com...
On May 20, 5:57 pm, jporter...@hotmail.com wrote:
>On May 20, 5:39 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<jporter...@hotmail.comwrote in message
>news:11**********************@n15g2000prd.googleg roups.com...
Hello,
I am working on a project to manipulate XML files. All of the files,
the code, and the output are on network drives. When I run my program
I get an exception (see below). I tried giving the LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc. This
had
no effect whatsoever. What do I need to do to fix this?
The XML files need to be on an accessible Network Share. It seems to me
that
you simply have a permission issue with the User Account being ran on
the
machine, which the program running under those User Account permissions
will
have as permission rights. If this is a Web based solution, then the
ASPNET
machine account may be coming into play as well.
>I am running this as a console application under my domain user
>account. The domain user account has Modify, Read & Execute, List
>Folder Contents, Read, Write NTFS permissions. Everyone has Full
>Control on share permissions. I can access all of the XML files for
>reading/wrting under any text editor using my domain user account. I
>don't think it is a simple file permissions issue in the operating
>system--it has to be in .NET. Any ideas?
>Thanks!
>Jeremy- Hide quoted text -
>- Show quoted text -
I forgot to mention that the program works when I copy and run it on
the local machine.
Your .Net Development machine as opposed to it being ran on a server, as an
example?
I would look at the .Net machine.config file. I know there is a .NET
utility to set application permission on a machine, but I don't remember the
name of the utility.
On your local machine, if that is your development machine, the program has
the .Net permissions, and when it's deployed to another machine it doesn't
have those permissions.
You may also want to look into setting a Domain Group Policy for .Net
applications.- Hide quoted text -
- Show quoted text -

Maybe I'm not explain this clearly. The program resides on a network
share and is run from the development machine on a network share. The
program is never run from any other computer. When it is run from the
network share it does not work. When I copy the program to a local
drive it works fine.

What domain policy would I set and what would that do exactly?

What am I looking for in Machine.Config?

Thanks for your help!

Jeremy- Hide quoted text -

- Show quoted text -
Any ideas?

May 23 '07 #7
On May 22, 9:34 pm, jporter...@hotmail.com wrote:
On May 21, 11:05 am, jporter...@hotmail.com wrote:
On May 21, 7:11 am, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<jporter...@hotmail.comwrote in message
>news:11**********************@y18g2000prd.googleg roups.com...
On May 20, 5:57 pm, jporter...@hotmail.com wrote:
On May 20, 5:39 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<jporter...@hotmail.comwrote in message
news:11**********************@n15g2000prd.googlegr oups.com...
Hello,
I am working on a project to manipulate XML files. All of the files,
the code, and the output are on network drives. When I run my program
I get an exception (see below). I tried giving the LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc. This
had
no effect whatsoever. What do I need to do to fix this?
The XML files need to be on an accessible Network Share. It seems to me
that
you simply have a permission issue with the User Account being ran on
the
machine, which the program running under those User Account permissions
will
have as permission rights. If this is a Web based solution, then the
ASPNET
machine account may be coming into play as well.
I am running this as a console application under my domain user
account. The domain user account has Modify, Read & Execute, List
Folder Contents, Read, Write NTFS permissions. Everyone has Full
Control on share permissions. I can access all of the XML files for
reading/wrting under any text editor using my domain user account. I
don't think it is a simple file permissions issue in the operating
system--it has to be in .NET. Any ideas?
Thanks!
Jeremy- Hide quoted text -
- Show quoted text -
I forgot to mention that the program works when I copy and run it on
the local machine.
Your .Net Development machine as opposed to it being ran on a server, as an
example?
I would look at the .Net machine.config file. I know there is a .NET
utility to set application permission on a machine, but I don't remember the
name of the utility.
On your local machine, if that is your development machine, the program has
the .Net permissions, and when it's deployed to another machine it doesn't
have those permissions.
You may also want to look into setting a Domain Group Policy for .Net
applications.- Hide quoted text -
- Show quoted text -
Maybe I'm not explain this clearly. The program resides on a network
share and is run from the development machine on a network share. The
program is never run from any other computer. When it is run from the
network share it does not work. When I copy the program to a local
drive it works fine.
What domain policy would I set and what would that do exactly?
What am I looking for in Machine.Config?
Thanks for your help!
Jeremy- Hide quoted text -
- Show quoted text -

Any ideas?
I think you're getting a security exception because your application
is being run from a network share and the default security policy
for .NET is granting partial trust to your application. When you run
the application on your local drive .NET gives the assembly full
trust. Take a look at Code Access Security.

May 30 '07 #8

<jp********@hotmail.comwrote in message
news:11**********************@h2g2000hsg.googlegro ups.com...
On May 21, 11:05 am, jporter...@hotmail.com wrote:
>On May 21, 7:11 am, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:


<jporter...@hotmail.comwrote in message
>news:11**********************@y18g2000prd.googleg roups.com...
On May 20, 5:57 pm, jporter...@hotmail.com wrote:
On May 20, 5:39 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<jporter...@hotmail.comwrote in message
>news:11**********************@n15g2000prd.googleg roups.com...
Hello,
I am working on a project to manipulate XML files. All of the
files,
the code, and the output are on network drives. When I run my
program
I get an exception (see below). I tried giving the
LocalIntranet_Zone
full permissions in the .NET Framework 2.0 Configuration msc.
This
had
no effect whatsoever. What do I need to do to fix this?
The XML files need to be on an accessible Network Share. It seems
to me
that
you simply have a permission issue with the User Account being ran
on
the
machine, which the program running under those User Account
permissions
will
have as permission rights. If this is a Web based solution, then
the
ASPNET
machine account may be coming into play as well.
>I am running this as a console application under my domain user
account. The domain user account has Modify, Read & Execute, List
Folder Contents, Read, Write NTFS permissions. Everyone has Full
Control on share permissions. I can access all of the XML files for
reading/wrting under any text editor using my domain user account. I
don't think it is a simple file permissions issue in the operating
system--it has to be in .NET. Any ideas?
>Thanks!
>Jeremy- Hide quoted text -
>- Show quoted text -
I forgot to mention that the program works when I copy and run it on
the local machine.
Your .Net Development machine as opposed to it being ran on a server,
as an
example?
I would look at the .Net machine.config file. I know there is a .NET
utility to set application permission on a machine, but I don't
remember the
name of the utility.
On your local machine, if that is your development machine, the program
has
the .Net permissions, and when it's deployed to another machine it
doesn't
have those permissions.
You may also want to look into setting a Domain Group Policy for .Net
applications.- Hide quoted text -
- Show quoted text -

Maybe I'm not explain this clearly. The program resides on a network
share and is run from the development machine on a network share. The
program is never run from any other computer. When it is run from the
network share it does not work. When I copy the program to a local
drive it works fine.
Sorry, I had not paid attention to this post. I got too many reply posts in
other NG(s) I can't keep track of them all. :)

Anyway, the fact that it won't work on a network share, which is on a
machine that doesn't have .Net Sercurity coniguration set right as opposed
to you running this application on a loacal machine is an indication of what
is wrong.

The program is trusted on the local machine.
>>
What domain policy would I set and what would that do exactly?
You'll have to talk with your Domain Admin people about setting Domain
policies for any machine connected to a Domain. There can be a policy set
for each machine for .NET that the machine will adhear to. I don't know what
has to be set, just know that it can.

<snipped>
>
Any ideas?
1) How to use the .Net Framework Configuration Utility for 1.1, 2.0 or 3.0.

2) How to use the SecPol.exe at the Command Prompt.

3) How to use the .Net Framework GacUtil.exe at the Command Prompt.

There should be articles out there on Google covering the 3 above.

May 30 '07 #9

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

Similar topics

5
by: PCC | last post by:
I am using the Exception Managment Application Block on Windows Server 2003 Enterprise and .NET v1.1. If I use the block with an ASP.NET web wervice or in a web application I get the following...
3
by: nick | last post by:
The program runs well on Local harddisk. But it always popup the exception if I run it on Netware mapping disk. After debugger say there is no source code on the exception. Also the following error...
0
by: Jake Holt | last post by:
I'm a converted Java programmer so go easy on me.. Basically I wrote a program for my Sales department that parses EDI 852s and returns a csv file for them. My problem is when i move it to the...
13
by: Dennis C. Drumm | last post by:
I use the Documents and Settings\All Users\Application Data\AppName folder to store xml settings that are applicable to all user who log onto a machine. (The uers personal settings associated with...
1
by: Moe | last post by:
I have a winForm control that contains an openFileDialog. I am using this control in a webForm by enbedding it using an <object> tag. I need to access some information about the file on the client....
19
by: Diego F. | last post by:
I think I'll never come across that error. It happens when running code from a DLL that tries to write to disk. I added permissions in the project folder, the wwwroot and in IIS to NETWORK_SERVICE...
8
by: Vai2000 | last post by:
Hi All, How do I access a shared Drive which requires username and password to access? I need to write a file in a folder within it TIA
0
by: Edhy Rijo [Progytech] | last post by:
Hi All, I am very new to VB.NET and creating small project to that will copy all files from a DVD to a folder in the Hard Drive. While doing the copy around 30% I got the following error: ...
3
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.