I am using speedy layout for a Sitecore SXA project. There is an exception that occurs in logs sometimes in the below method.

private static string DownloadCssFile(string url, bool acceptJs = false)
    string cssFileCacheKey = $"speedy-external-css-{url}";
    string cssFileCache = HttpContext.Current.Cache[cssFileCacheKey] as string;

    if (SpeedyGenerationSettings.IsDebugModeEnabled())
        cssFileCache = null;

    if (!string.IsNullOrWhiteSpace(cssFileCache))
        return cssFileCache;
        var uri = HttpContext.Current.Request.Url;
        var host = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port;
            WebClient client = new WebClient();
            string reply = client.DownloadString(host + url);
            if (!string.IsNullOrWhiteSpace(reply))
                CacheObject(cssFileCacheKey, reply, GetDependencies(null));
            return reply;
        catch (Exception ex)
            Diagnostics.Log.Error("Download CSS SpeedyAssetLinksGenerator" , ex);
    return string.Empty;

Error is as below:

2536 18:06:49 ERROR Download CSS SpeedyAssetLinksGenerator
Exception: System.NotSupportedException
Message: The given path's format is not supported.
Source: mscorlib
    at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
    at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
at System.Net.WebClient.GetUri(String path)
at System.Net.WebClient.DownloadString(String address)
at Sitecore.Foundation.Speedy.Speedy.SpeedyAssetLinksGenerator.DownloadCssFile(String url, Boolean acceptJs)

I believe error is coming from:

CacheObject(cssFileCacheKey, reply, GetDependencies(null));

But I am not able to find any solution. Can anyone please help?

2 Answers 2


Looking at your log, I think it is coming from

string reply = client.DownloadString(host + url);

Somehow the file that you are trying to fetch, is not supported. I don't think it is related to caching. If it finds the file at specified path, it will download and then cache. Rather, it is failing to download that file.

Personally I have never used this module so I will suggest you to check few things -

  • First you need to find failing URL
  • I would suggest you to download source code and add logs to record generated URL (line 237 in this file )
  • Compile this new code and deploy. And then check logs.

This will give you url that is causing problem.

I anticipate this is related to some setting in Config like 'allowed file extensions'. But once you have logs, you will be able to narrow down your problem.

Hope this helps !


The error message "The given path's format is not supported" indicates that the WebClient.DownloadString(string address) method is having trouble with the URL format being passed to it. Try the below steps :

  1. Examine how the url parameter is constructed before being passed to DownloadString. Make sure it's a valid, well-formed URL that the WebClient class can understand. Check for any special characters or encoding issues within the URL that might be causing parsing problems. Consider using Uri.TryCreate to validate the URL format before using it with WebClient.

  2. Explore alternative methods for downloading the CSS file. You could potentially use the System.Net.Http.HttpClient class, which offers more control over request headers and might be more flexible in handling different URL formats.

Hope this helps !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.