Restricting folder and sub-folder access via IP in web.config RRS feed

  • Question

  • User694418659 posted


    We have some code in our web.config file which restricts access from all IP addresses accept those we have listed. Here is an extract:

    <location path="unicol">



    <ipSecurity allowUnlisted="false">


    <add ipAddress="" subnetMask="" allowed="true"/>




    Question: would all subfolders under "unicol" be automatically included, or do they have to be individually specified? We have people being denied access to the folder "unicol/archives" (403.6 error) yet are able to access the "unicol" folder without issue. Content is at http://www.rcycp.com/unicol/archives


    Wednesday, October 24, 2018 1:14 PM

All replies

  • User753101303 posted


    You mean they can't access "unicol" but can still access to "unicol/archives" ?

    AFAIK it will work just for this particular location. If instead you use a web.config file in the unicol folder (with just those settings), I expect this to be inherited by child folders (also an IP can easily be forged FAIK

    Wednesday, October 24, 2018 1:37 PM
  • User694418659 posted


    No, the other way round. Access is good at unicol but not at unicol/archives

    BTW, our web.config is in the root folder ie. www.rcycp.com


    Wednesday, October 24, 2018 2:17 PM
  • User1724605321 posted

    Hi stabes,

    Please try to add config file in unicol folder , not  specify a location tag, so that the the configuration will apply to this entire folder and its subfolders.

    Best Regards,

    Nan Yu

    Thursday, October 25, 2018 6:44 AM
  • User694418659 posted

    Thanks. Are you saying that I should add the web.config file to the unicol folder and remove the lines where the specific IP addresses are specified?

    Thursday, October 25, 2018 7:04 AM
  • User1724605321 posted

    Hi stabes,

    You can create a new web.config file in the particular directly which you want to protect :


    Best Regards,

    Nan Yu

    Friday, October 26, 2018 2:53 AM