How to add MIME types to the Web. config configuration file in ASP.

Source: Internet
Author: User

There are often some special MIME types that are not in IIS and are generally added manually by ourselves. If the site frequently changes the server or the site code is provided to multiple users, it will cause the special MIME type used in the site to be regularly configured on IIS. Given the commonality of a Web site configuration, we can add MIME types to the ASP. NET site configuration file so that users don't have to configure IIS all the time.

In general, we are configuring this part of the MIME information in the Staticcontent node of the system.webserver node, as long as the fileextension file extension attribute in the MimeMap node is set and MimeType this MIME type property (Click this link Common MIME types).

The approximate code is as follows (the extensions and MIME types added in the code are just examples):

<system.webServer> <staticContent> <remove fileextension=". Woff"/> <remove fileextension=". XAP"/> <remove fileextension=". xaml"/> <remove fileextension=". apk"/> <mimemap fileextension=". Woff"Mimetype="Font/x-font-woff"/> <mimemap fileextension=". XAP"Mimetype="Xapapplication/x-silverlight"/> <mimemap fileextension=". xaml"Mimetype="Application/xaml+xml"/> <mimemap fileextension=". apk"Mimetype="application/vnd.android.package-archive"/> </staticContent> </system.webServer>

How to add MIME types to the Web. config configuration file in ASP.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.