ASP.NET Core 2: Javascript CDNs and Fallbacks

Content Deployment Networks (CDN) are great for deploying javascipt, CSS and other resources which might be common. jQuery is a great example. When your site uses a CDN that another site your user has used, your user might already have the resource in their cache so your site will load faster.

ASP.NET Core handles these nicely and offers fallback support so if the CDN is down your site won’t go down.

<script src=""


There are 2 new TagHelpers here.

asp-fallback-src: Simply indicates where the backup script is on your system

asp-fallback-test: This is the object that ASP.NET Core will look for. If it’s not found after the load attempt, your fallback will be used.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s