Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Security Error When calling assembly.CreateInstance

Reply
Thread Tools

Security Error When calling assembly.CreateInstance

 
 
Roman
Guest
Posts: n/a
 
      11-16-2003
I don't event know where to begin to solve it. I tried
everything I could find on the net, with no avail. I ma
loading an assembly using http. Here are the steps
leanding to the assembly load and create object instance
in this assembly:

1. Assembly name definition

AssemblyName assemblyName = new AssemblyName();
assemblyName.CodeBase =
@"http://localhost/Parsers/Ess/1.0.0.0/EdmXslParserEss.dll
";
assemblyName.HashAlgorithm = AssemblyHashAlgorithm.SHA1;
assemblyName.VersionCompatibility =
AssemblyVersionCompatibility.SameProcess;
assemblyName.Flags = AssemblyNameFlags.PublicKey;
assemblyName.KeyPair = new StrongNameKeyPair(File.Open
(@"C:\Key.snk", FileMode.Open,
FileAccess.Read));assemblyName.Version = new
System.Version("1.0.0.0");

2. Assambly load

Assembly assembly = AppDomain.CurrentDomain.Load
(assemblyName);

3. Create an object

EdmBaseParser parser = assembly.CreateInstance
(edmLaboratoryModel.Parser, true,
BindingFlags.CreateInstance, null, new object[]{}, null,
null) as EdmBaseParser;

That is where I am getting the "Security Error"
(System.Security.SecurityException).


The object that get created (EdmBaseParser) uses an
introp.Excel which is a local resource. But I am using
strong names so it shouldn't be a problem.

 
Reply With Quote
 
 
 
 
Ram Sunkara [msft]
Guest
Posts: n/a
 
      11-17-2003
Send complete error stack trace!!!

"Roman" <> wrote in message
news:02e101c3ac55$4a097fc0$...
> I don't event know where to begin to solve it. I tried
> everything I could find on the net, with no avail. I ma
> loading an assembly using http. Here are the steps
> leanding to the assembly load and create object instance
> in this assembly:
>
> 1. Assembly name definition
>
> AssemblyName assemblyName = new AssemblyName();
> assemblyName.CodeBase =
> @"http://localhost/Parsers/Ess/1.0.0.0/EdmXslParserEss.dll
> ";
> assemblyName.HashAlgorithm = AssemblyHashAlgorithm.SHA1;
> assemblyName.VersionCompatibility =
> AssemblyVersionCompatibility.SameProcess;
> assemblyName.Flags = AssemblyNameFlags.PublicKey;
> assemblyName.KeyPair = new StrongNameKeyPair(File.Open
> (@"C:\Key.snk", FileMode.Open,
> FileAccess.Read));assemblyName.Version = new
> System.Version("1.0.0.0");
>
> 2. Assambly load
>
> Assembly assembly = AppDomain.CurrentDomain.Load
> (assemblyName);
>
> 3. Create an object
>
> EdmBaseParser parser = assembly.CreateInstance
> (edmLaboratoryModel.Parser, true,
> BindingFlags.CreateInstance, null, new object[]{}, null,
> null) as EdmBaseParser;
>
> That is where I am getting the "Security Error"
> (System.Security.SecurityException).
>
>
> The object that get created (EdmBaseParser) uses an
> introp.Excel which is a local resource. But I am using
> strong names so it shouldn't be a problem.
>



 
Reply With Quote
 
 
 
 
Roman
Guest
Posts: n/a
 
      11-19-2003
Sorry, I was away yestarday. Here is the stck trace;

StackTrace " at
System.Security.CodeAccessSecurityEngine.CheckHelp er
(PermissionSet grantedSet, PermissionSet deniedSet,
CodeAccessPermission demand, PermissionToken permToken)
at Excel.ApplicationClass.get_Workbooks()
at
Com.Abetelo.Edm.Parsers.EdmBaseParser.AllocateExce lWorkshe
et(String fileName) in c:\documents and settings\keith
sullivan\my documents\aif\presentation - windows
forms\edmparser\edmbaseparser.cs:line 125
at Com.Abetelo.Edm.Parsers.Ess.EdmXslParserEss.Parse
(String fileName) in c:\documents and settings\keith
sullivan\my documents\aif\presentation - windows
forms\edmxslparseress\edmxslparseress.cs:line 116
at Com.Abetelo.Edm.EdmParserManager.Parser(String
fileName) in c:\documents and settings\keith sullivan\my
documents\aif\presentation - windows
forms\edmapplication\edmparsermanager.cs:line 158
at Com.Abetelo.Edm.EdmApplication.Initialize() in
c:\documents and settings\keith sullivan\my
documents\aif\presentation - windows
forms\edmapplication\edmapplication.cs:line 80
at Com.Abetelo.Edm.EdmApplication..ctor(XmlDocument
xplXmlDocument) in c:\documents and settings\keith
sullivan\my documents\aif\presentation - windows
forms\edmapplication\edmapplication.cs:line 58
at Com.Abetelo.Edm.EdmApplication.Main() in
c:\documents and settings\keith sullivan\my
documents\aif\presentation - windows
forms\edmapplication\edmapplication.cs:line 185"
string




>-----Original Message-----
>Send complete error stack trace!!!
>
>"Roman" <> wrote in

message
>news:02e101c3ac55$4a097fc0$...
>> I don't event know where to begin to solve it. I tried
>> everything I could find on the net, with no avail. I ma
>> loading an assembly using http. Here are the steps
>> leanding to the assembly load and create object

instance
>> in this assembly:
>>
>> 1. Assembly name definition
>>
>> AssemblyName assemblyName = new AssemblyName();
>> assemblyName.CodeBase =
>>

@"http://localhost/Parsers/Ess/1.0.0.0/EdmXslParserEss.dll
>> ";
>> assemblyName.HashAlgorithm =

AssemblyHashAlgorithm.SHA1;
>> assemblyName.VersionCompatibility =
>> AssemblyVersionCompatibility.SameProcess;
>> assemblyName.Flags = AssemblyNameFlags.PublicKey;
>> assemblyName.KeyPair = new StrongNameKeyPair(File.Open
>> (@"C:\Key.snk", FileMode.Open,
>> FileAccess.Read));assemblyName.Version = new
>> System.Version("1.0.0.0");
>>
>> 2. Assambly load
>>
>> Assembly assembly = AppDomain.CurrentDomain.Load
>> (assemblyName);
>>
>> 3. Create an object
>>
>> EdmBaseParser parser = assembly.CreateInstance
>> (edmLaboratoryModel.Parser, true,
>> BindingFlags.CreateInstance, null, new object[]{},

null,
>> null) as EdmBaseParser;
>>
>> That is where I am getting the "Security Error"
>> (System.Security.SecurityException).
>>
>>
>> The object that get created (EdmBaseParser) uses an
>> introp.Excel which is a local resource. But I am using
>> strong names so it shouldn't be a problem.
>>

>
>
>.
>

 
Reply With Quote
 
Guest
Posts: n/a
 
      11-19-2003
Ram,

I am getting out of my mind dealing with this problem.
What do you think I should do.

Roman
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
com.ms.security, com.ms.security.PermissionID.FILEIO and error in compiling Marco Java 1 01-28-2006 11:18 PM
calling virtual function results in calling function of base class... Andreas Lagemann C++ 8 01-10-2005 11:03 PM
Calling FormsAuthentication.SignOut() after calling Response.Flush =?Utf-8?B?TWFydGluIExlZQ==?= ASP .Net 1 09-28-2004 12:47 PM
Server Side button calling page_load before calling it's own click event. Ryan Ternier ASP .Net 4 07-29-2004 01:06 PM
IT-Security, Security, e-security COMSOLIT Messmer Computer Support 0 09-05-2003 08:34 AM



Advertisments