What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service.
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 }

You need to ensure that the correct authentication header is present when requests are made by using MyDataServiceContext.
What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service.
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 }

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 segmen 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 segmen at line 06:
Proxy.SendingRequest += new EventHandler<SendingRequestEventArgs>(proxy_SendingRequest);
Insert the following code segmen at line 09:
void proxy_SendingRequest(object sender, SendingRequestEventArgs e){
e.RequestsHeaders.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.RequestsHeaders.Add(�Authorization�,�WRAP access_token�, �123456789�);
}



Leave a Reply 1

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