PrepAway - Latest Free Exam Questions & Answers

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

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 Sub GetProducts()
04
05 Dim proxy = New MyDataServiceContext()
06
07
08 End Sub
09
10 End Class
You need to ensure that the correct authentication header is present when requests are made by
using MyDataServiceContext. What should you do?

PrepAway - Latest Free Exam Questions & Answers

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.
AddHandler proxy.SendingRequest, New _
EventHandler(Of SendingRequestEventArgs)( _
AddressOf proxy_SendingRequest)
Insert the following code segment at line 09.
Sub proxy_SendingRequest(ByVal sender As Object,
ByVal e As SendingRequestEventArgs)
e.RequestHeaders.Add(“WRAP access_token”, “123456789”)
End Sub

D.
Insert the following code segment at line 06.
AddHandler proxy.SendingRequest, New EventHandler(
Of SendingRequestEventArgs)( _
AddressOf proxy_SendingRequest)
Insert the following code segment at line 09.

Sub proxy_SendingRequest(ByVal sender As Object,
ByVal e As SendingRequestEventArgs)
e.RequestHeaders.Add(“Authorization”,
“WRAP access_token=””123456789″””)
End Sub


Leave a Reply