By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,983 Members | 2,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,983 IT Pros & Developers. It's quick & easy.

FileIO Exception and permissions

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a

<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

P: n/a
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

P: n/a
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

P: n/a

<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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

<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 discussion thread is closed

Replies have been disabled for this discussion.