开发者

How can Application Domains be used to host 3rd party assemblies that provide UI controls in a Web or Windows app?

MSDN says:

Isolating applications is also important for application security. For example, you can run controls from several Web applications in a single browser process in such a way that the controls cannot access each other's data and resources.

How would this be accomplished? If I am using controls from an assembly on my WebForm as part of the UI, how would I load that from a separate domain?

开发者_StackOverflow社区

Also, is this possible in Windows Forms, to have UI controls on your forms that are from an assembly loaded in a separate appdomain? If so, how would you do so?

I ask because I use many 3rd party UI control libraries. How would I use these in a "safe" way, hosted from a different application domain from my main application?


If you read further, you can see you can create multiple domains in your process and Load assemblies into them or Execute assemblies in them.

Now from what you ask I think you misunderstood the concept a little. The assemblies in two different domains are fully separated, they can't access each other, so what you want to do, to load UI controls to a separate domain and use it in your original domain, is not possible.

The citation you wrote talks about scenarios such as concurrent user access to a single asp.net application, or mutliple "tabs" in a single internet explorer showing multiple webpages. These need to be securely separated which can be accomplished either by creating a completely new process for each user request or tab or by creating separate appdomains. The gain provided by appdomains here is better scalability / peformance because creating a new process for every single request to asp.net application would be too costly.

So to answer your question: if you want to use 3rd party controls and want them to interact with your main app, you can't load them into separate domain unless you can make them communicate with your app through network, remoting, pipes etc.


0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜