Search this blog

You can search for all the topics in our blog using our google custom search now.

Search the blog

Loading

Friday, July 23, 2010

Application Domain Tutorial Part 2

If you haven't gone through my previous tutorial then please do, below is the link:

Application Domain Tutorial Part 1

CONFIGURING APPLICATION DOMAINS
------------------------------------------------

We need configure application domains to create customized environments for the assemblies.If you run an assembly with full trust access then one: There is no point of running that assembly in an application domain and Two: Your application domain becomes vulnerable for any security risks.

So one way to limit access privileges to the assemblies is by using EVIDENCE. Evidence is the access privileges information of the assembly which is gathered by runtime.You need add System.Security.Policy namespace to be able to create Evidence for an assembly.In our previous example we ran an assembly in an application domain using ExecuteAssembly Method.Now in this example, we will use ExecuteAssemblyByName method to run an assembly with access privileges limited to local computer.Remember you can do the same using ExecuteAssembly Method as well.

Watch this video from here:




To be continued in next video.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Policy;


namespace AppdomainEx1
{
    class Program
    {
        static void Main(string[] args)
        {
            object[] hEvidence = {new Zone(System.Security.SecurityZone.MyComputer) };
            Evidence AppEvidence = new Evidence(hEvidence,null);
            AppDomain d = AppDomain.CreateDomain("HelloWorldDomain");
  
            d.ExecuteAssemblyByName("HelloWorld",AppEvidence);
            AppDomain.Unload(d);
        }
    }
}

Tags: Microsoft MCTS exam, Learn, Tutorials, Free C#, Free Videos, Microsoft Dot Net Jobs,Microsoft Dot Net Jobs Interview, Free Training and Preparation, Jobs MCTS specialization, visual studio.net.

1 comment:

  1. nice tutorials on application domain

    but i had some doubts like
    i had created the classlibrary1.dll
    it contains the method like testmethod()
    in this method iam moving to the
    "www.google.com" using process.start
    so i need to call this

    classlibrary1.class1.testmenthod(),
    so how can using the code according to the part-4 using the security acess
    replay me

    ReplyDelete