Integrating CDN Link into .NET MVC Project

Setting Up a Custom CDN Hostname with BunnyCDN

In this guide, we will walk you through the process of setting up a custom CDN hostname using BunnyCDN. This will allow you to use a subdomain of your choice (e.g., instead of the default hostname.


  • A BunnyCDN account. If you don't have one, sign up for a free trial.
  • A domain name and access to its DNS settings.

Step 1: Create a Pull Zone

  1. Log in to your BunnyCDN account.
  2. Navigate to the Pull Zones tab and click Add Pull Zone.
  3. Enter a name for your Pull Zone (e.g., my-pull-zone).
  4. Enter the URL of the origin server (e.g.,
  5. Click Create Pull Zone.

Step 2: Set Up a Custom CDN Hostname

  1. In the list of Pull Zones, click on the name of the Pull Zone you created.
  2. Navigate to the Custom Domains tab.
  3. Enter your desired subdomain (e.g., in the Custom Domain field.
  4. Click Add Custom Domain.

Step 3: Configure DNS Settings

  1. Log in to your domain registrar or DNS hosting provider.
  2. Create a new CNAME record or update the existing one with the following details:
    • Name: Enter your desired subdomain (e.g., cdn).
    • Type: CNAME.
    • Value: Enter the CNAME value provided by BunnyCDN (e.g.,
  3. Save the changes and wait for the DNS records to propagate (usually within a few minutes).

Step 4: Validate the Custom CDN Hostname

  1. Go back to the Custom Domains tab in your BunnyCDN Pull Zone.
  2. Click Check DNS next to your custom domain.
  3. If the DNS records have propagated correctly, you will see a green checkmark and the message "DNS is configured correctly."

Now your custom CDN hostname is set up and ready to use. To serve content from this hostname, simply replace the default URLs in your application or website with the new custom CDN hostname.

For example, if you have an image hosted at, you can now serve it through your custom CDN hostname like this:

To use the custom CDN hostname in your .NET MVC project, you can follow these steps:

  1. In your project, right-click on the "Content" folder and select "Add" > "Existing Item".
  2. Navigate to the folder where you have your images, CSS, or JavaScript files.
  3. Select the files you want to add to your project and click "Add".
  4. In the "Properties" window, set the "Copy to Output Directory" property to "Copy if newer".
  5. In the file path, replace the local path with the CDN link. For example, if your CDN link is and your file path is Content/images/my-image.png, change the file path to
  6. Repeat steps 4 and 5 for all the files you want to use with the CDN link.

After following these steps, your .NET MVC project will use the custom CDN hostname for the selected files. This will help to improve the performance of your website and reduce the load on your server.

Related Articles
Coming Soon