SecurityException

W

Wally Pipp

Hello All,

I've just inherited a PC with XP, so I loaded VS2005 on it and was running a
simple windows application when I got a SecurityException just trying to
open a file with the following message:

Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


When I use the following:

FileStream fs = File.Open(@"C:\txtFiles\File2.txt", FileMode.Open );


I went to Control Panel->Administrative Tools->MS ...Framework 2.0->My
Computer->Runtime Security Policy->Increase Assembly Trust for mscorlib.dll,
but it didn't help.

Any suggestions?

Thanks,
Wally
 
N

Nicholas Paldino [.NET/C# MVP]

Wally,

Are you running this assembly from the local machine? If so, are the
settings for that assembly such that you don't have full trust?

Also, does the user that you are running the app under actually have
rights to the file?
 
W

Wally Pipp

Wally,
Are you running this assembly from the local machine? If so, are the
settings for that assembly such that you don't have full trust?

Also, does the user that you are running the app under actually have
rights to the file?

Hi Nicholas,

Found the problem. The app was running in a folder that was mapped to one of
the servers.

Thanks,
Wally

Hello All,

I've just inherited a PC with XP, so I loaded VS2005 on it and was running
a
simple windows application when I got a SecurityException just trying to
open a file with the following message:

Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


When I use the following:

FileStream fs = File.Open(@"C:\txtFiles\File2.txt", FileMode.Open );


I went to Control Panel->Administrative Tools->MS ...Framework 2.0->My
Computer->Runtime Security Policy->Increase Assembly Trust for
mscorlib.dll,
but it didn't help.

Any suggestions?

Thanks,
Wally






--------------------------------------------------------------------------
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top