Search this blog

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

Search the blog


Saturday, July 24, 2010

Application Domain Tutorial Part 3


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

Free Microsoft MCTS 70-536 Examination Training and Preparation for Jobs

Application Domain Tutorial Part 2

As we have seen that we can restrict  access to any resource for an assembly. Now what if you want to provide some access privileges and restrict some access privileges for an application domain? How would you do it? Answer is quite simple, you do it the same way you did for an assembly.First create a host evidence object array and then create EVIDENCE for the application domain. You can pass the EVIDENCE as a parameter to CreateDomain Method.

I will upload a video on this post soon.
Meanwhile, below is the code for creating an application domain with configured access privileges and with custom properties set.

Watch the video to learn how to configure application domain:

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);
            AppDomainSetup setup = new AppDomainSetup();
            setup.ApplicationBase = System.Environment.CurrentDirectory;
            setup.DisallowCodeDownload = false;
            setup.DisallowBindingRedirects = false;

            setup.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            AppDomain d = AppDomain.CreateDomain("HelloWorldDomain",AppEvidence,setup);
            //d.ExecuteAssembly(@"C:\Users\Owner\Documents\Visual Studio 2008\Projects\HelloWorld\HelloWorld\bin\Debug\HelloWorld.exe");

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

No comments:

Post a Comment