Microsoft Exam Questions

You need to ensure that the correct authentication header is present when requests are made by using

You use Microsoft .NET Framework 4 to develop an application that uses WCF Data Services to
retrieve entities. WCF Data Services uses an authentication scheme that requires an HTTP request
that has the following header format.
GET /OData.svc/Products(1)
Authorization: WRAP access_token=”123456789″
The application includes the following code. (Line numbers are included for reference only.)
01 public class Program
02 {
03 public void GetProducts()

04 {
05 var proxy = new MyDataServiceContext();
06
07 …
08 }
09
10 }
You need to ensure that the correct authentication header is present when requests are made by
using MyDataServiceContext. What should you do?

A.
Insert the following code segment at line 06.
proxy.Credentials = new NetworkCredential
(“WRAP access_token”, “123456789”);

B.
Insert the following code segment at line 06.
proxy.Credentials = new NetworkCredential
(“Authorization”, “WRAP access_token=\”123456789\””);

C.
Insert the following code segment at line 06.
proxy.SendingRequest += new
EventHandler<SendingRequestEventArgs>
(proxy_SendingRequest);
Insert the following code segment at line 09.
void proxy_SendingRequest(object sender,
SendingRequestEventArgs e) {
e.RequestHeaders.Add(“WRAP access_token”, 123456789″);
}

D.
Insert the following code segment at line 06.
proxy.SendingRequest += new EventHandler
<SendingRequestEventArgs>(proxy_SendingRequest);
Insert the following code segment at line 09.
void proxy_SendingRequest(object sender,
SendingRequestEventArgs e)
{
e.RequestHeaders.Add(“Authorization”,
“WRAP access_token=\”123456789\””);
}