Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably deliver messages at no cost.
Steps to get server key / SenderID

  1. To get the keys, log in to Firebase account.
  2. Select the project from the list.
  3. Click on "Setting" gear icon and click "Project Settings". 

  4. Click on "Cloud Messaging" tab to select "Server key" and "Sender key" from the below screen.

Add the below code to send push notifications.

//Create the web request with fire base API
WebRequest tRequest = WebRequest.Create("https://fcm.googleapis.com/fcm/send");  
tRequest.Method = "post";  
//serverKey - Key from Firebase cloud messaging server  
tRequest.Headers.Add(string.Format("Authorization: key={0}", serverKey));  
//Sender Id - From firebase project setting  
tRequest.Headers.Add(string.Format("Sender: id={0}", senderId));  
tRequest.ContentType = "application/json";  
var payload = new {  
    to = deviceId,  
        priority = "high",  
        content_available = true,  
        notification = new {  
            body = txtmsg,  
                title = txttitle.Replace(":", ""),  
                sound = "sound.caf",  
                badge = badgeCounter  
        },  
};  
var serializer = new JavaScriptSerializer();  
Byte[] byteArray = Encoding.UTF8.GetBytes(payload);  
tRequest.ContentLength = byteArray.Length;  
using(Stream dataStream = tRequest.GetRequestStream()) {  
    dataStream.Write(byteArray, 0, byteArray.Length);  
    using(WebResponse tResponse = tRequest.GetResponse()) {  
        using(Stream dataStreamResponse = tResponse.GetResponseStream()) {  
            if (dataStreamResponse != null) using(StreamReader tReader = new StreamReader(ataStreamResponse)) {  
                String sResponseFromServer = tReader.ReadToEnd();  
                result.Response = sResponseFromServer;  
            }  
        }  
    }  
}

HostForLIFE.eu ASP.NET Core 2.2.1 Hosting

European best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.