Mike Greenway

If I build a empty project on my XP machine savinging it in a folder on my vista machine, I get the below when I test run it from VS2008B2 on the XP machine. If I build and save an empty project from 2008 onto a directory on the XP machine, No Problem.

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

It is "help out the Befuddled week" and here is your chance.

Thank you

Mike Greenway




Re: Visual C# 2008 (Pre-release) SecurityException was Unhandled

Peter Ritchie

By "folder on my Vista machine", I assume you mean network share. By default, network shares do not have full trust. You can use .NET Configuration 2.0 in the Administrative Control Panel to add that share to the LocalIntranet_Zone machine code group. Or, you can simply run the following from a Visual Studio 200x command prompt:

Code Snippet

caspol -m -ag LocalIntranet_Zone -url "\\servername\sharename\*" FullTrust -n "Trusted Network Share" -d "Trusted Network Share."






Re: Visual C# 2008 (Pre-release) SecurityException was Unhandled

Mike Greenway

Good Morning - Thank you for your help.

I used the .Net Framework 2.0 Configuration (in admin. tools) to "Adust Zone Security" to "Full Trust" on the machine the I'm using to write the code. I start a new project to be saved on the network share (Public on My vista machine); it builds fine, but debug gets me the same message.

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

Interesting, no






Re: Visual C# 2008 (Pre-release) SecurityException was Unhandled

Peter Ritchie

I'm not sure what you mean bye "adjust zone security". Do you mean you've right-clicked the "Runtime Security Policy" node and you've selected "Adjust Security..."

I would try the caspol method to see if that makes a difference.






Re: Visual C# 2008 (Pre-release) SecurityException was Unhandled

Mike Greenway

Hi Peter

Sorry It took so long to reply.

I clicked on "Runtime Security Policy" in the left-hand panel of ".Net Framework 2.0 Configuration" tool.

Then I left clicked "Adjust Zone Security" in the right-hand panel, this brings up a wizard that helped me set the rights of all programs from the local Intanet zone to full.

I have retruned there now and it seems to be correct. "Full Trust" but the problem still exsists.

Did I set the right thing

I really appreciate your help

Mike






Re: Visual C# 2008 (Pre-release) SecurityException was Unhandled

Peter Ritchie

Mike Greenway wrote:

Hi Peter

Sorry It took so long to reply.

I clicked on "Runtime Security Policy" in the left-hand panel of ".Net Framework 2.0 Configuration" tool.

Then I left clicked "Adjust Zone Security" in the right-hand panel, this brings up a wizard that helped me set the rights of all programs from the local Intanet zone to full.

I have retruned there now and it seems to be correct. "Full Trust" but the problem still exsists.

Did I set the right thing

I really appreciate your help

Mike

I've never tried doing that. I wouldn't recommend doing that because you really don't know what's accessible to your computer to run from the Intranet. For example, if another computer on the intranet was infected with a virus, with FullTrust for the Intranet zone you're open to infection. But, you can see if it had an effect on CAS permissions by expanding Runtime Security Policy/Machine/Code Groups, right click on LocalIntranet_Zone and click the Permission Set tab.

The recommendation is to grant access to individual assemblies or folders on the intranet either through the .NET Configuration tool or caspol. The .NET Configuration tool will no longer be shipped with future versions of .NET or the .NET SDK; which really leaves using caspol as a long-term recommendation. I've used both these methods successfully.






Re: Visual C# 2008 (Pre-release) SecurityException was Unhandled

Mike Greenway

Hi Peter

I'm sorry to be such a headache but I use getting in over my head w/ .net config so I tried the commandline in vs2008

i copied the text

>caspol -m -ag LocalIntranet_Zone -url "\\Mikegreenway\public\*" FullTrust -n "Trusted Network Share" -d "Trusted Network Share."

Command "caspol" is not valid.

>

sometimes things aren't as easy as we would like





Re: Visual C# 2008 (Pre-release) SecurityException was Unhandled

Marcelo Guerra - MSFT

Hi,

You should have caspol when using VS2008 command line. My caspol is in C:\Windows\Microsoft.NET\Framework\v2.0.50727\CasPol.exe

Marcelo.