Complete the code to set the default caching behavior in Azure CDN.
cdnEndpoint.DefaultCacheBehavior = new CacheBehavior { CacheDuration = TimeSpan.FromSeconds([1]) };The default cache duration is set in seconds. 60 seconds is a common default for short caching.
Complete the code to add a caching rule that bypasses caching for query strings.
cdnEndpoint.CachingRules.Add(new CachingRule { QueryStringCachingBehavior = [1] });BypassCache means the CDN will not cache responses when query strings are present.
Fix the error in setting the cache duration to 2 hours in Azure CDN caching rule.
cachingRule.CacheDuration = TimeSpan.FromSeconds([1]);2 hours equals 7200 seconds, so the cache duration must be set to 7200.
Fill both blanks to configure a caching rule that caches only if the request method is GET and the response status code is 200.
cachingRule.MatchConditions.Add(new RequestMethodCondition { Method = "[1]" });
cachingRule.MatchConditions.Add(new ResponseStatusCodeCondition { StatusCode = [2] });GET requests with 200 status code are typically cached to serve valid content.
Fill all three blanks to create a caching rule that caches content for 30 minutes, ignores query strings, and caches only for GET requests.
var cachingRule = new CachingRule {
CacheDuration = TimeSpan.FromSeconds([1]),
QueryStringCachingBehavior = "[2]",
MatchConditions = { new RequestMethodCondition { Method = "[3]" } }
};30 minutes is 1800 seconds, ignoring query strings means caching regardless of them, and caching GET requests is standard.