RE: Help: Security Exception

From: Stren Assaf (StrenAssaf_at_discussions.microsoft.com)
Date: 07/18/04


Date: Sun, 18 Jul 2004 01:48:01 -0700

Human Resources

Thanks Nirro for your reply but....

I think this is not the case here.
First I set the permission of ALL zones to the maximum and still the same.
Second as I wrote - I do succeed on executing the file from the shared directory and the exception is accurse only after I am doing an ODBC action.

Still looking for a solution.

Thanks again.

"Niroo" wrote:

> A very popular question which is answered ...
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/faq111700.asp
>
> The default security policy is to treat code loaded from a file share as partially trusted. It is treated as the IntraNet zone and gets the permissions assigned to that zone.
>
> Niroo
>
> "Stren Assaf" wrote:
>
> > I wrote a C# application that uses ODBC connection to MS-Sql server. The executable is located on one computer on the local network and Im accessing it from a nother pc. I succeed to open it but when im making a databse operation Im getting the following message:
> > "The application attempted tp perform an operation not allowed by the security policy. The operation required the SecurityException. To grant this application the required premission please contact your system administrator or use the ...."
> >
> > What do I need to do ????
> >
> > this is the details of the message:
> > ************** Exception Text **************
> > System.Security.SecurityException: Security error.
> > at ODBCConnect..ctor()
> > at McCann.frmUserConnect.btnOK_Click(Object sender, EventArgs e) in C:\Dev\McCann Ericson\frmUserConnect.cs:line 164
> > at McCann.frmUserConnect.frmUserConnect_KeyPress(Object sender, KeyPressEventArgs e) in C:\Dev\McCann Ericson\frmUserConnect.cs:line 217
> > at System.Windows.Forms.Control.OnKeyPress(KeyPressEventArgs e)
> > at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
> > at System.Windows.Forms.Form.ProcessKeyPreview(Message& m)
> > at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
> > at System.Windows.Forms.Control.WmKeyChar(Message& m)
> > at System.Windows.Forms.Control.WndProc(Message& m)
> > at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
> > at System.Windows.Forms.TextBox.WndProc(Message& m)
> > at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
> > at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
> > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
> >
> >
> > ************** Loaded Assemblies **************
> > mscorlib
> > Assembly Version: 1.0.3300.0
> > Win32 Version: 1.0.3705.288
> > CodeBase: file:///c:/windows/microsoft.net/framework/v1.0.3705/mscorlib.dll
> > ----------------------------------------
> > System
> > Assembly Version: 1.0.3300.0
> > Win32 Version: 1.0.3705.288
> > CodeBase: file:///c:/windows/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
> > ----------------------------------------
> > System.Drawing
> > Assembly Version: 1.0.3300.0
> > Win32 Version: 1.0.3705.288
> > CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
> > ----------------------------------------
> > Mccann
> > Assembly Version: 1.0.1641.27118
> > Win32 Version: 1.0.1641.27118
> > CodeBase: file://nipendo1/C/Dev/McCann%20Ericson/bin/Debug/Mccann.exe
> > ----------------------------------------
> > System.Windows.Forms
> > Assembly Version: 1.0.3300.0
> > Win32 Version: 1.0.3705.288
> > CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
> > ----------------------------------------
> > System.Xml
> > Assembly Version: 1.0.3300.0
> > Win32 Version: 1.0.3705.288
> > CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.3300.0__b77a5c561934e089/system.xml.dll
> > ----------------------------------------
> > ODBCCOnnect
> > Assembly Version: 0.0.1.0
> > Win32 Version: 0.0.1.0
> > CodeBase: file://nipendo1/C/Dev/McCann%20Ericson/bin/Debug/ODBCCOnnect.DLL
> > ----------------------------------------
> > System.Data
> > Assembly Version: 1.0.3300.0
> > Win32 Version: 1.0.3705.288
> > CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.3300.0__b77a5c561934e089/system.data.dll
> > ----------------------------------------
> > Microsoft.Data.Odbc
> > Assembly Version: 1.0.3300.0
> > Win32 Version: 1.0.4030.0
> > CodeBase: file:///c:/windows/assembly/gac/microsoft.data.odbc/1.0.3300.0__b77a5c561934e089/microsoft.data.odbc.dll
> > ----------------------------------------
> >



Relevant Pages

  • Re: Custom permissions not throwing exceptions
    ... You might try running under a zone other than MyComputer. ... I'll attach a ... sample that creates a sandbox you can use to run the test program. ... then create a code group which uses that permission set. ...
    (microsoft.public.dotnet.security)
  • Re: Goodbye OWS Goodbye Obama
    ... Zone in the manner, the time AND the place THEY decide, not the State! ... As Americans our "permission" was granted by ... WWI vets provide lesson for Occupy marchershttp://www.app.com/article/20111114/NJOPINION02/311140072/WWI-vets-pr ... ...
    (alt.gathering.rainbow)
  • Re: Custom permissions not throwing exceptions
    ... the sandbox sample I sent will always run with LocalIntranet ... permission. ... update that should let you chooze the zone to test under. ... The>>> membership condition for the code group would determine who could use ...
    (microsoft.public.dotnet.security)
  • Re: How to assert UIPermission from .NET usercontrol hosted in IE?
    ... Notice that the zone is MyComputer ... which I'm assuming that's because of where the failing assembly lives. ... Request for the permission of type ... msg, IntPtr wparam, IntPtr lparam) ...
    (microsoft.public.dotnet.security)