all groups > dotnet security > july 2006 >
You're in the

dotnet security

group:

how to grant the application the required permission?


how to grant the application the required permission? sgllc98 NO[at]SPAM gmail.com
7/26/2006 1:22:20 PM
dotnet security:
Hi gurus,

I wrote a small exe file using vs 2005. the exe file is pretty simple.
just open a web site using
System.Diagnostics.Process.Start("http://website"). The exe file works
fine in my machine. But it can not open the website if I run it in
another machine. I got an error box say, The application attempted to
perform an operation not allowed by the security policy. To grant
this application the required permission please contact your system
administrator or using .net framwork configuration tool.....

how to grant the application the required permission? Thanks,

Ben
Re: how to grant the application the required permission? sgllc98 NO[at]SPAM gmail.com
7/27/2006 7:39:16 AM
Thanks Nicole,

Yes this exe will run across the network. I made some change as you
said, use clickonce and give the application a full trust. But it seems
the same. exe file works fine. just cann't open the browser.

[quoted text, click to view]
Re: how to grant the application the required permission? Nicole Calinoiu
7/27/2006 9:53:13 AM
Is the executable being run from the local machine or across the network?
The Process class has a link demand for unrestricted CAS permissions (aka
"full trust"), which is not granted to non-local assemblies under default
CAS policy. (See
http://blogs.msdn.com/shawnfa/archive/2003/06/20/57023.aspx for more info.)
There are three basic approaches to addressing this:

1. Run a local copy of the app,
2. Use ClickOnce to deploy your application with an extended CAS permission
grant, or
3. Adjust the CAS policy on the individual client machines.



[quoted text, click to view]
Re: how to grant the application the required permission? Nicole Calinoiu
7/27/2006 3:17:45 PM
Could you please post the full exception details (including call stack
listing), as returned from the exception's ToString method?


[quoted text, click to view]
Re: how to grant the application the required permission? sgllc98 NO[at]SPAM gmail.com
7/28/2006 8:19:00 AM
here are the error message


just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Security.SecurityException: Request failed.
at
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly
asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle
rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object
assemblyOrString, PermissionSet granted, PermissionSet refused,
RuntimeMethodHandle rmh, SecurityAction action, Object demand,
IPermission permThatFailed)
at
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet
grants, PermissionSet refused, PermissionSet demands,
RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction
action, Boolean throwException)
at
System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack
cs, PermissionSet grants, PermissionSet refused, PermissionSet demands,
RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)
at signin.frmsignin.btnsignin_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
The action that failed was:
LinkDemand
The type of the first permission that failed was:
System.Security.PermissionSet
The Zone of the assembly that failed was:
Intranet



[quoted text, click to view]
Re: how to grant the application the required permission? Nicole Calinoiu
7/31/2006 9:32:04 AM
Are you constraining your CAS permissions in any way (e.g.: via use of
assembly-level RequestOptional or RequestRefuse permission attributes)? If
not, could you please post your button's click event code?


[quoted text, click to view]
AddThis Social Bookmark Button