473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Newbe: C# 2003 PermissionSet question

I have created a user control which I would like to use in other
projects.
When I try to create an instance on a form in an other project I get an
error message.

This is the AssemblyInfo.cs of my control:

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;

[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\MyControl.snk")]
[assembly: AssemblyKeyName("")]

[assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted =
false)]

[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
This is the text of the error message:

An exception occurred while trying to create an instance of
MyControl.MyControl
The exception was "Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlob,
Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089
failed

I think the problem arises from my PermissionSet(...,...).

Has anyone a suggestion which PermissionSet I should use to solve this?

Thanks in advance.

Aug 14 '06 #1
3 1697
I am not sure about this, but shouldn't you at first request a
permission before instantiating this (custom) control?

See:
..NET Framework Developer's Guide --Requesting Permissions
Executor wrote:
I have created a user control which I would like to use in other
projects.
When I try to create an instance on a form in an other project I get an
error message.

This is the AssemblyInfo.cs of my control:

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;

[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\MyControl.snk")]
[assembly: AssemblyKeyName("")]

[assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted =
false)]

[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
This is the text of the error message:

An exception occurred while trying to create an instance of
MyControl.MyControl
The exception was "Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlob,
Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089
failed

I think the problem arises from my PermissionSet(...,...).

Has anyone a suggestion which PermissionSet I should use to solve this?

Thanks in advance.
Aug 14 '06 #2
You don't need PermissionSet for control. I got a sample for you but 111kb
after zip so can't send over.

chanmm

"Executor" <wo**********@sogeti.nlwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>I have created a user control which I would like to use in other
projects.
When I try to create an instance on a form in an other project I get an
error message.

This is the AssemblyInfo.cs of my control:

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;

[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\MyControl.snk")]
[assembly: AssemblyKeyName("")]

[assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted =
false)]

[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
This is the text of the error message:

An exception occurred while trying to create an instance of
MyControl.MyControl
The exception was "Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlob,
Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089
failed

I think the problem arises from my PermissionSet(...,...).

Has anyone a suggestion which PermissionSet I should use to solve this?

Thanks in advance.

Aug 14 '06 #3
I figured it out:

The permission line shuld read:

[Assembly: SecurityPermissionAttribute(SecurityAction.Request Minimum,
Execution =True, Unrestricted =False)]

Thanks to all who tried to inform me.

Aug 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mario Pranjic | last post by:
Hi! I have a scalar function that returns integer: xview (int) Now, I'm trying to build a procedure that has the following select inside: select atr1, xview(atr2) from tablename
8
by: adrien | last post by:
Hi, i start with javascript and i saw a lot of examples, but sometimes there is ";" on each end of line, sometimes only certain lines, sometimes nowhere. So my question is: where must i put ";"...
0
by: Nick Zdunic | last post by:
I have this code which throws up an error on my box (Windows Sever 2003 - Enterprise Edition) MsgBox("Message", MsgBoxStyle.Question OrMsgBoxStyle.MsgBoxSetForeground, "Title") I have tried...
3
by: MikeP | last post by:
Hello, I am planning on going head first into C++.I have programmed in VB and still work with php regularly.Should I pursue Microsoft's implementation of C++( That being C++.net) or just learn it...
9
by: Yaro | last post by:
Hello DB2/NT 8.1.3 Sorry for stupid questions. I am newbe in DB2. 1. How can I read *.sql script (with table and function definitions) into a database? Tool, command... 2. In Project Center...
1
by: Jim | last post by:
I have created a windows form that contains several tab pages which contain a panels. On a tab page I am trying to dynamically create a series of buttons in that pages panel. I am failing because...
2
by: fizgig | last post by:
Hi all, I've been meaning to ask this for a long time, but my computer has been down more then has been up, but my question is when I bought Microsoft Visual C#.NET Standard 2003 Edition I also...
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
0
by: SMichal | last post by:
Hi, I've got a simple problem when I try to start a new process from my application. I'm starting a new process like this: Process proc = new Process(); proc.StartInfo.Arguments = "";...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.