Submit a Ticket
Support Center » Knowledgebase » Tutorials: Step-by-Step Help » Allow/Deny IPs via web.config

Allow/Deny IPs via web.config

In order to allow or deny cetain IPs via the web.config, please follow the steps below:


1. Login to the WebsitePanel




2. Choose File Manager from under your Hosting Space (Soho/Business/Mocha...).




3. Navigate to your domain.com/wwwroot/ directory and edit the web.config.




4. Add the following code into your web.config just under the <system.webServer> tag.

  • For blocking specific IP addresses:
<security>
   <ipSecurity allowUnlisted="true">          
       <clear/>               
       <add ipAddress="10.0.0.1"/>          
   </ipSecurity>
</security>

PS: 10.0.0.1 being the IP you wish to block.

  • Deny all, but allow specific IPs or networks:
<security>
    <ipSecurity allowUnlisted="false">               
        <clear/>
        <add ipAddress="127.0.0.1" allowed="true"/>
        <add ipAddress="10.0.0.1" allowed="true"/>                           
    </ipSecurity>
</security>

PS: 127.0.0.1 is allowed so the web-server/localhost can connect to your website and process your files.

If you wish to allow / deny a whole network rather than just one IP, you can add the following between the IP address subnetMask="255.255.255.0" (you will need to chang the subnetMask depending on the range of the network), so the completed line will look like this:

<add ipAddress="10.0.0.1" subnetMask="255.255.255.0/>

or

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






5. After you are done modifying the web.config, click Save.

 This answer was helpful  This answer was not helpful
 Back