PrepAway - Latest Free Exam Questions & Answers

Which two actions should you perform?

You develop a Web application that writes data to a file on a server. You restrict access to the file to specific Windows users.
The Web application runs as CONTOSOASPNET. You deny anonymous access to the application in IIS. You add the following XML segment in the Web.config file.

<authentication mode="Windows"/>

You need to ensure that the application meets the following requirements:
1. It must impersonate the user when it writes data to the file
2. It must run as CONTOSOASPNET when a user does not access the file.
Which two actions should you perform?
(Each correct answer presents part of the solution. Choose two.)

PrepAway - Latest Free Exam Questions & Answers

A.
Use the following XML segment in the Web.config file. <identity impersonate="false"/>

B.
Use the following XML segment in the Web.config file. <identity impersonate="true"/>

C.
Use the following code segment to access the file. WindowsPrincipal wp =(WindowsPricipal)HttpContext.Current.User;WindowsIdentity wi= (WindowsIdentity)wp.Identity;WindowsImpresonationContext wic=wi.Impersonate();// Access teh fileherewic.Undo();

D.
Use the following code segment to access the file. WindowsIdentity wi = WindowsIdentity.GetCurrent();WindowsImpersonationContext wic= WindowsIdentity.Impersonate(wi.Token);// Access the file herewic.Undo();


Leave a Reply