Filter posts by the Tags of Blog section!

Different file extensions in core Friday, 03 August 2018

In my earlier related post to this subject, I wrote that there is config in core to enable the static file access but that's not Ok for every sort of file, for example, you can't access to an APK file in your directory. In order to that, you can use FileExtensionContentTypeProvider class like this:


var contentTypes = new FileExtensionContentTypeProvider();

            contentTypes.Mappings[".apk"] = "application/";

            app.UseStaticFiles(new StaticFileOptions


                ContentTypeProvider = contentTypes



Needless to say, this configuration should be placed in the Configure method:


 public void Configure(IApplicationBuilder app, IHostingEnvironment env)



comments powered by Disqus