A System.SecurityException exception occurs when you use Swing components in J# Browser Controls (835464)
The information in this article applies to:
- Microsoft Visual J# .NET (2003)
SYMPTOMSWhen you run a
Microsoft J# Browser Control that uses Swing components, a System.SecurityException
exception occurs.
Note Swing components are implemented in the Microsoft Supplemental UI
Library for Visual J# .NET 1.1 (Vjssupuilib.dll).CAUSEFrom a
partially trusted assembly, you cannot call assemblies that allow only fully
trusted assemblies to call them. From a partially trusted assembly, when you
try to call assemblies that allow only fully trusted assemblies to call them, a
System.SecurityException exception occurs.
By default, J# Browser
Controls are only partially trusted. The Supplemental UI Library for
Visual J# .NET 1.1 allows only fully trusted assemblies to call it. Therefore,
when you use Swing components in J# Browser Controls, a
System.SecurityException exception occurs.
Note You can use the AllowPartiallyTrustedCallers attribute to allow your full-trusted library to be called by partially trusted code.WORKAROUNDTo work around
this behavior, change the security policy for your computer so that the
assembly that contains your J# Browser Control code is fully trusted. To do
this, sign the assembly with a strong name, and then make this strong name
fully trusted. To do this, use either of the following methods: Use the Microsoft .NET Framework Configuration tool (Mscorcfg.msc)- Sign the assembly that contains your J# Browser Control
code with a strong name.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
321917
HOW TO: Create a strong named assembly in Visual J# .NET
- Start the .NET Framework Configuration tool.
- In the left pane, expand Runtime Security
Policy, expand Machine, and then expand Code
Groups.
- Right-click All_Code, and then click
New. The Create Code Group dialog box
appears.
- Click to select the Create a new code
group option.
- In the Name box, type
Test, and then click Next.
- To fully trust the strong name of the assembly that
contains your J# Browser Control code, follow these steps:
- In the Choose the condition type for this code
group list,
click Strong Name, and then click Import.
The Import Strong Name From Assembly dialog box
appears.
- Locate and then click the assembly that contains your
J# Browser Control code, and then click Open.
- Click Next.
- In the Use existing permission set list,
click FullTrust.
- Click Next, and then click
Finish.
Use the Code Access Security Policy tool (Caspol.exe)- Sign the assembly that contains your J# Browser Control
code with a strong name.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
321917
HOW TO: Create a strong named assembly in Visual J# .NET
- Start the Microsoft Visual Studio .NET 2003 command
prompt.
- Run the following command to obtain the value of the label
of the All_Code code group, and then note down this
value:
caspol -listgroups - To grant FullTrust permissions to the assembly that
contains your J# Browser Controls code, run the following command at the
command prompt:
caspol -addgroup
label_value -strong -file
AssemblyFileName AssemblyName
AssemblyVersion FullTrust -name
"Test"
Notes- In the previous command, replace
label_value with the value of the label of the
All_Code code group. This value is the same as the value that you noted down in
step 3.
- AssemblyFileName,
AssemblyName, and
AssemblyVersion are placeholders for the file name
of your assembly, the display name of your assembly, and the complete version
number of your assembly respectively.
STATUS This
behavior is by design.REFERENCESFor more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
Modification Type: | Major | Last Reviewed: | 4/9/2004 |
---|
Keywords: | kbpolicy kbConfig kbTrusts KbUIDesign kbSecurity kberrmsg kbprb KB835464 kbAudDeveloper |
---|
|