简体   繁体   中英

How to configure alwaysAllowedQueryStrings in IIS 7.5

Now I have issue on web-site which developed by me. If user types a sequence of dots (more than 2) to the end of URL, he will get default 404 response from IIS. But I want that this case will be handled by ASP.Net code. I'm trying to configure my IIS to allow this sequence, but I'm unsuccessful in this. I don't understand what I do wrongly. For this I add next lines to my web.config file (here I used 3 dots just for testing):

<system.webServer>
...
            <security>
            <requestFiltering>
              <alwaysAllowedQueryStrings>
                  <add queryString="\..." />
              </alwaysAllowedQueryStrings>
            </requestFiltering>
        </security>
  </system.webServer>

In visual studio node alwaysAllowedQueryStrings marked by blue waved line as invalid. And VS shows following message: "The element 'requestFiltering' has an invalid child element 'alwaysAllowedQueryStrings'. List of possible elements expected: 'fileExtensions, requestLimits, verbs, hiddenSegments, denyUrlSequences'". So it seems like IIS or VS does not know about this type of node. But next link:
http://www.iis.net/configreference/system.webserver/security/requestfiltering/alwaysallowedquerystrings says that "alwaysAllowedQueryStrings" is a default feature of IIS 7.5 and on server I have IIS 7.5.7600.16385.

I tried to reinstall request filtering feature of IIS, but unfortunately nothing was changed.

Please share your ideas why it does not work for me.

I think you are in the wrong path. While "/Page.someextension" could be a valid request to a resource on a web server, "/Page.someextension." may not be, because this a different request to a different file named "Page.someextension."

This has nothing to do with query strings.

If you would like to accept a request like "/Page.someextension." and handle it with "Page.someextension" maybe URL Rewrite will do what you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM