Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Eric1243123 4 posts 57 karma points
    Sep 11, 2024 @ 17:31
    Eric1243123
    1

    Umbraco treating certain file types differently

    Hello,

    I'm running Umbraco 13, and in my wwwroot folder I have 2 files, MyProgram.exe and MyImage.iso. If I try to navigate to ~/MyProgram.exe, it triggers a download, which is what I want. When trying to navigate to the ISO however, it throws a 404 page.

    I have both of these mimeMaps configured the same in web.config and IIS, so I'm very confused as to why EXE works, but not ISO.

    Is there some setting for types in the backoffice? Is it some implicit thing from Umbraco?

    Any pointers are greatly appreciated!

  • Yakov Lebski 590 posts 2344 karma points
    Sep 11, 2024 @ 23:41
    Yakov Lebski
    101

    I belive it mime tipe in asp.net core, try add this file to your project

          public class CoreComposer : IComposer
        {
            public void Compose(IUmbracoBuilder builder)
            {  
                var contentTypeProvider = new FileExtensionContentTypeProvider();
                if (!contentTypeProvider.Mappings.ContainsKey(".iso"))
                {
                    contentTypeProvider.Mappings.Add(".iso", "application/octet-stream");
                }          
    
                builder.Services.Configure<StaticFileOptions>(options => options.ContentTypeProvider = contentTypeProvider);
            }
        }
    }
    
  • Eric1243123 4 posts 57 karma points
    Sep 12, 2024 @ 16:00
    Eric1243123
    0

    Works now, thanks a bunch!

Please Sign in or register to post replies

Write your reply to:

Draft