AZ-204 – Question 120


You are a developer for a Software as a Service (SaaS) company. You develop solutions that provide the ability to send notifications by using Azure Notification Hubs.
You need to create sample code that customers can use as a reference for how to send raw notifications to Windows Push Notification Services (WNS) devices.
The sample code must not use external packages.
How should you complete the code segment? To answer, drag the appropriate code segments to the correct locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
NOTE: Each correct selection is worth one point.
Select and Place:
Correct Answer:
Box 1: windows –
Example code:
var request = new HttpRequestMessage(method, $”{resourceUri}?api-version=2017-04″); request.Headers.Add(“Authorization”, createToken(resourceUri, KEY_NAME,
request.Headers.Add(“X-WNS-Type”, “wns/raw”);
request.Headers.Add(“ServiceBusNotification-Format”, “windows”); return request;
Box 2: application/octet-stream –
Example code capable of sending a raw notification:
string resourceUri = $”https://{NH_NAMESPACE}{HUB_NAME}/messages/”; using (var request = CreateHttpRequest(HttpMethod.Post, resourceUri))
request.Content = new StringContent(content, Encoding.UTF8,
request.Content.Headers.ContentType.CharSet = string.Empty;
var httpClient = new HttpClient();
var response = await httpClient.SendAsync(request);


Please enter your comment!
Please enter your name here