Assmebly.Load error using Byte()

M

mathlec

I have 2 WebApplication project (dummy and dummy2).

The first is trying to load a UserControl compiled in the second.
I've set up the application as follow:

[dummy]
\_(Virtual directory)
.:Modules:.

[dummy2]
\_(physical directory)
-Modules-
\index.aspx (inherits dummy.index)


The idea behind this setup is that dummy is a "general" application I
use in to build web sites. I often want personalized module, and I
don't want to modify the "base" application.
The web sites are formed of a client part and an administration part.

My idea was to set up a virtual directory in the administrative part
that points in the client part. That directory hold pages who inherits
type from the base application. That way they can benefit from all the
logique of the base app.

Now, from those page I register a UserControl which will hold the new
module.

Of course, this will generate a "Type not found" as soon as the parser
hit the @control instruction.

I added an @Assembly instruction in the user control naming the client
assembly name.

This will fire my AssemblyResolve from the base application which in
return will try to load the assembly asked.

If I use Assembly.LoadFrom (which will call the fusion), the DLL is
loaded and everythings works fine... until I try to recompile the
client application. Obviously this will generate an error since the
main app will have locked it (since it was charged in the othe
AppDomain).

So I figured I'd use Assembly.Load and read the raw bytes from the
client DLL and load it...

That's when I get a very nice error:

Description: An unhandled exception occurred during compilation using
the CodeDomProvider 'Microsoft.VisualBasic.VBCodeProvider'. Please
review the stack trace for more information about the error and where
it originated in the code.

Exception Details: System.ArgumentException: Illegal characters in
path.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.


Stack Trace:


[ArgumentException: Illegal characters in path.]
System.IO.Path.GetFileName(String path) +113

Microsoft.VisualBasic.VBCodeGenerator.CmdArgsFromParameters(CompilerParameters
options) +241

System.CodeDom.Compiler.CodeCompiler.FromFileBatch(CompilerParameters
options, String[] fileNames) +447
System.CodeDom.Compiler.CodeCompiler.FromDomBatch(CompilerParameters
options, CodeCompileUnit[] ea) +428
System.CodeDom.Compiler.CodeCompiler.FromDom(CompilerParameters
options, CodeCompileUnit e) +90

System.CodeDom.Compiler.CodeCompiler.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromDom(CompilerParameters
options, CodeCompileUnit e) +37
System.Web.Compilation.BaseCompiler.GetCompiledType() +227


I'm not sure what's the problem here... anyone?

Thank you
 

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,163
Latest member
Sasha15427
Top