Web Push Notifications on .Net Server
In this guide we are going to help you setup Web Push notifications on .Net website. You could be running on ASP or any other language on a Windows Server.
Setting up Web Push Notification on .NET Server (IIS Manager)
After you have signed up for a new account on PushAlert.co, head to the Dashboard and into the Integrate section. You can setup web push notifications for both HTTP and HTTPS websites.
HTTP Website
For HTTP websites, only our JavaScript code needs to be integrated on your website. Just include the code in the <head> section and that’s it. The opt-in would be automatically shown to your subscribers. You can also setup welcome notifications which are send out as soon your visitors subscribe.
HTTPS Website
For HTTPS websites, you also need to copy two files to the root of your website - manifest.json and sw.js.
Now, if you are running an older version of IIS then you also need to add json as a MIME type in IIS Manager. Its pretty easy and there are two ways to do it:
1. Using IIS Manager:
- Search for IIS Manager and open it.
-
Browse to the Server where your website is hosted.
- Locate Mime Types and see if json type is defined. If it exists, no need to make any changes and you can skip all the next steps. Your integration is complete.
- If it doesn’t exist, right click on the Mime Types page and then click on Add.
- In the File name extension field enter - json and set MIME type as “application/json”.
- Hit OK and you are all set.
2. Using Application Host Config file (applicationhost.config):
-
First you need to find applicationhost.config file, based on your installation the file will either be located in one of the following locations:
- Documents > IISExpress
- C:\Windows\System32\inetsrv\config
- Once you have found this file, you need to open it in an editor in Administrator mode with elevated permissions to change its contents.
-
Search for the following string:
- <staticContent lockAttributes=”isDocFooterFileName”>
- Then, see if you can find json listed in the mimeMap.
-
If it is not listed add this line among the other fileExtension listing:
- <mimeMap fileExtension=”.json” mimeType=”application/json” />
- Then save the file and Restart IIS.
- If you are unable to save the file, you must not have opened it in administrator mode. You can open your favorite editor in administrator mode by searching for it in the start menu and then right click on it, tap on More > Run as administrator.