Azure CDN endpoint working status

319 views Asked by At

i am using the AZure CDN to store the JS,CSS and images. I want to check whether the AZURE CDN endpoint is working or not. If not working then i want to make use website content folders. How can i check whether the endpoint is working or not using the C# code?

Thanks, Pavan

1

There are 1 answers

0
olsh On

You can use the fallback mechanism for CDN URLs

In your BundleConfig.cs

For css files

bundles.Add(new StyleBundle("~/Content/css", "http://CDN_URL.vo.msecnd.net/Content/css")
    // If it falls, then your website content will be loaded
    .IncludeFallback("~/Content/css", "sr-only", "width", "1px")
    .Include(
          "~/Content/bootstrap.css",
          "~/Content/site.css"));

Almost the same for js files

bundles.Add(new ScriptBundle("~/bundles/jquery", 
"http://CDN_URL.vo.msecnd.net/bundles/jquery") 
                // If it falls, then your website content will be loaded
                { CdnFallbackExpression = "window.jquery" }
                .Include("~/Scripts/jquery-{version}.js"));