First of all, don't overestimate what happens when you create "assembly". You don't create and assembly as it is understood on .NET, as the main unit of .NET modularity and main functional object of .NET.
You merely obtain a reference to the instance of the class
System.Reflection.Assembly
:
https://msdn.microsoft.com/en-us/library/system.reflection.assembly%28v=vs.110%29.aspx[
^].
Can you see the difference? This is not the assembly, but the instance of the class representing the assembly as it is understood in reflection
technology
. Essentially, this is something which allows you to work with assembly types, something which allows you not just to use the assembly metadata to instantiate some classes and fetch any information on the assembly metadata. Depending on how you do it, you can get different in reflection-only content.
You did not bother to explain what you are going to do with the assembly, so I'll just answer your questions.
To load assembly, you need to look at the methods
Assembly.Load
,
Assembly.LoadFile
,
Assembly.LoadFrom
,
Assembly.LoadWithPartialName
,
Assembly.ReflectionOnlyLoad
and
Assembly.UnsafeLoadFrom
:
https://msdn.microsoft.com/en-us/library/system.reflection.assembly%28v=vs.110%29.aspx[
^].
You can create a new instance of the
System.Reflection.Assembly
object through these methods. There is nothing like "save as"; it would not make any sense. I hope that assigning the
Assembly
-type variable to another variable will merely create a new reference to the same object, not a new object.
Also, you can generate some assembly on the fly. This is done either via CodeDOM or
System.Reflection.Emit
. These are the cases when you really create new code on the fly. You did not mention any possibilities like that, so I'll only give you the basic references:
https://msdn.microsoft.com/en-us/library/650ax5cx%28v=vs.110%29.aspx[
^],
https://msdn.microsoft.com/en-us/library/8ffc3x75%28v=vs.85%29.aspx[
^].
How to do it all in ASP.NET? ASP.NET is based on .NET, so the answer is: in the same very ways explained above. Only why? You think about it yourself; you did not bother to explain your idea.
Now, about JavaScript: it has nothing to do with assemblies and .NET and ASP.NET. It is something executed in the browser, that is, in the client part, and ASP.NET works totally on the server part. The only possible role of JavaScript would be just to send some HTTP request to the server side; and the server side can do whatever you program on the server side. To send HTTP request, you need to use AJAX:
http://en.wikipedia.org/wiki/Ajax_(programming)[
^].
The whole question makes very little to no sense. I'm afraid it's based on some illusions.
—SA