The ASP. NET configuration does not allow URLs to access resources under the directory

Source: Internet
Author: User

After the ASP is published, some files are not accessed directly through URL for security purposes.

There are usually 2 ways of doing this:

1. Set the file directory in the default hidden directory such as App_code or App_Data

2. Add the file directory to the hidden segment of the request filter so that the file cannot be accessed directly through the URL

In IIS configuration is request filtering---> Add hidden segments, the configuration in IIS is actually the configuration Web. config file

can also be directly on the web. Config file inside configuration, configuration/system.webserver/security/requestfiltering/hiddensegments node

Add a directory that does not allow direct URL access

<system.webServer> <staticContent> <remove fileextension=". Woff"/> <mimemap fileextension=". Woff"Mimetype="Font/x-font-woff"/> <remove fileextension=". WOFF2"/> <mimemap fileextension=". WOFF2"Mimetype="Font/x-font-woff"/> </staticContent> <validation validateintegratedmodeconfiguration="true"/> <modules></modules> <security> <requestFiltering> <!--maxallowedcontent Length=100mb--> <requestlimits maxallowedcontentlength="104857600"></requestLimits> "File"/> <!--file folder cannot be downloaded directly hidden segments--

The ASP. NET configuration does not allow URLs to access resources under the directory

Related Article

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: 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.