I have a website under www.somedomain.com
. Now, I would like to setup IIS to display some simple single-html page that says "site under maintenance" or something like that to all my users who access it, but also, I want to have full access to my website when I enter it. So basically I want to disable all IP's but mine from using the website. How can I do it?
Basic IIS setup will let you block/allow based on IP. If you want to redirect a user based on IP, you should look at URL Rewrite (http://www.iis.net/downloads/microsoft/url-rewrite). Specifically, an inbound rule that works off the condition REMOTE_ADDR.
Verify that you have the 'IP and Domain Restrictions module' installed, if not, install it:
Only allow your own IP address to access the site:
now everybody else gets a standard IIS "403 - Forbidden: Access is denied" page.
You want to replace this page with your own. Build an Html page that has no dependencies on any other resources, include the css on the page, and also all images:
You need to encode your images into base64, but you can create a nice enough looking page without images.
You could also references images on another server, but I like to keep my error pages self-contained.
Save the file to the root of your site e.g.: C:\inetpub\wwwroot\403.html
finally set IIS to use your new page:
Your page will now be displayed for all 403 status codes, not just IP restrictions, but that shouldn't be a big problem.