0

How to add the header in the WebRequest .

 HttpWebRequest tRequest = (HttpWebRequest)WebRequest.Create("https://fcm.googleapis.com/fcm/send");
            tRequest.Method = "POST";
            tRequest.ContentType = "application/json";
            var data = new
            {
                to = devicesId,
                notification = new
                {
                    body = "Fcm Test Notification",
                    title = "Test FCM",
                    sound = "Enabled"
                },
                priority = "high"
            };

            tRequest.Headers["Authorization: key={0}"] = appId;

            tRequest.Headers["Sender: id={0}"] = senderId; 

i need to add the header to create the web Request.

Thanks

3

1 Answer 1

0

Missing Add in HttpWebRequest is because have missing ISerializable in CoreFx (so you can not simply tRequest.Headers.Add("name", "value");). They working on it and you can follow at https://github.com/dotnet/corefx/issues/12669

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.