Security violation when trying to bring up help

V

Vance Gloster

Hi,

Thanks to the MVPs for all the help the last few days. You guys really
saved me.

The problem I am currently having is that I am doing the following (C#):

Help.ShowHelp(this, "help.htm");

This brings up an HTML page that contains the very simple help information
for the application. This help file gets installed in the same directory as
the application. It works well on my development machine, but when I run it
on a test machine (Windows98 with the .NET 1.1 framework) I get a security
exception. It appears that the default security settings for the 1.1
framework do not allow this.

So how can I bring up a single HTML help page without requiring my user to
change the security permissions (not practical)? The error information is
included below. Thanks!

-Vance Gloster

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 System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Windows.Forms.Help.ShowHTMLFile(Control parent, String url,
HelpNavigator command, Object param)
at System.Windows.Forms.Help.ShowHelp(Control parent, String url,
HelpNavigator command, Object param)
at System.Windows.Forms.Help.ShowHelp(Control parent, String url)
at NC_Desktop.MainWindow.buttonHelp_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.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.573
CodeBase:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
XXXXXXXX
Assembly Version: 5.0.1501.31677
Win32 Version: 5.0.1501.31677
CodeBase: file:///G:/INSTALL%20NC%20DESKTOP/TRY/XXXXXXXX.EXE
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.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.
 
Y

Ying-Shen Yu[MSFT]

Hi Vance,

Thanks for posting in the community.

regarding this is a Security Exception issue, could you let us know more
information about this exception, such as the
GrantedSet
PermissionState,
PermissionType,
RefusedSet
and Source
It will provide more information which might help us researching this issue.
We will looking forward to your detail information.
Thanks!



Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.
 
Y

Ying-Shen Yu[MSFT]

Hi Vance,

Also, according to the Doc of the ShowHelp method,

SecurityPermission to access a HTML help file not served from a HTTP
Server. Associated enumeration: UnmanagedCode

It needs UnmanagedCode Permission to ccess the local HTML help file. you
may check if your app have this permission when running. Basically you
would have this problem if your app is an IE Hosted or smart client app. In
this case, you may define your own permission set in the .Net Framework
Configuration Tool.

Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.
 

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