Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Net Framework error when running application from the server 1

Status
Not open for further replies.

LaneyVC50

Technical User
Mar 1, 2002
17
GB
Hi Guys

I have written a vb.net (2003) application.

The application when loaded reads the system login name and basically copies some config files either to the local machine or back to the server.

It also reads paths from an XML file.

The problem l am having is with windows security. When they run the application locally it works perfectly

When they copy the files to the server and run them they get the following .Net Framework error:

------------------------------------
The application attempted to perform an operation not allowed by the security policy. The operation required the SecurityException. To grant this application please contact you.... etc

Requet for the permission of type
Syste.Security.Permissions.SecurityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Security.SecurityException: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at NetworkInfo.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.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.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
NetworkLogOn
Assembly Version: 1.0.2399.22708
Win32 Version: 1.0.2399.22708
CodeBase: file://192.168.1.3/IMR%20Public%20Folder/test%20apps'/NetworkLogOn.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

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

I know this is a windows security error and have tried a couple of things like adding the app so windows knows what it is etc

This app has been written to run as a log on script so l need to be able to run it without having to add it to a security module manually. It has to be automatic.

Have any of you seen this problem before or do you know a possible solution to it.

Hope that all makes sense

Any help would be greatly appreciated.
TIA
 
Use the .NET Framework configuration tool (under Admin Tools) to access the Runtime Security Policy. Select Adjust Zone Security and increase the trust level for the Intranet zone. This will allow your client to run an assembly on the server.

Can't remember if you need to change this on both the server and the client, or just one. Try it and see.
 
You should create a new enterprise config file with a code group for your code (we used strong name to ensure anything we develop is fully trusted). C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorcfg.msc is the app to use.

Next overwrite the C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\enterprisesec.config file on every client with your newly created version.

You might want to try doing this in the login script, I think the command to use is
Code:
 objFileSystem.CopyFile sSource, sTarget

There are other ways to roll-out the new file if this isn't feasible.

Note: the enterprise level config file is the safest of the 3 files to overwrite, but if you need enterprise specific settings you should make sure the file you create covers everything you need.

Also, make sure you tick the box for 'policy levels below this level will not be evaluated'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top