How would you accomplish this?

You are in the process of creating an application on Domain.com’s Web sever named Certkiller -SR11.
This application will be used to manage confidential data from Domain.com’s business partners.
The application relies on several assemblies located in Domain.com’s intranet to fulfill its duties.
As a result, you have to verify that every assembly originates from the same intranet Web site.
How would you accomplish this?

You are in the process of creating an application on Domain.com’s Web sever named Certkiller -SR11.
This application will be used to manage confidential data from Domain.com’s business partners.
The application relies on several assemblies located in Domain.com’s intranet to fulfill its duties.
As a result, you have to verify that every assembly originates from the same intranet Web site.
How would you accomplish this?

A.
Use the following code:
public bool CheckSite (){
SiteMembershipCondition site = new
SiteMembershipCondition(“http//intranet.Domain.com”);
return site.Check (AppDomain.CurrentDomain.Evidence);
}

B.
Use the following code:
public bool CheckSite (){
Site site = new Site (“http//intranet.Domain.com”);
return site.Check (Assembly.GetCallingAssembly().Evidence);
}

C.
Use the following code:
public bool CheckSite (){
Site site = new Site (“http//intranet.Domain.com”);
return site.Check (AppDomain.CurrentDomain.Evidence);
}

D.
Use the following code:
public bool CheckSite (){
SiteMembershipCondition site = new
SiteMembershipCondition(“http//intranet.Domain.com”);
return site.Check (Assembly.GetCallingAssembly().Evidence);
}

Explanation:
This code instantiates a SiteMembershipCondition object using the site’s URL as a string, retrieves the evidence information from the current assembly, and verifies the evidence indicating the assembly originates from the company intranet. The SiteMembershipCondition class’ sole purpose is to verify whether an assembly belongs to a site’s
code group based upon the originating Web site of the application or assembly. The SiteMembershipCondition class has a constructor that takes a URL as a string argument. The Check method determines whether an assembly belongs to the site’s code group based upon the evidence
provided as an argument.
The GetExecutingAssembly method of the Assembly class returns an Assembly object representing the assembly
that invoked the CheckPolicy method.
The Evidence property of the Assembly class returns the identity information used by the .NET Framework code access security mechanism to determine code group membership.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


mr_tienvu

mr_tienvu

I have the same idea. D