Question

I'm testing an application in the staging slot within a given web role. I don't want the staging application to be accessible to the public and I was wondering if there was anything I could add to the .cscfg file to lock down the application to just a set of known IPs? I had a look around the portal but couldn't see any way to restrict IPs there.

Any thoughts on this?

Was it helpful?

Solution

You can enable the built in IIS IP and Domain Restrictions and then provide a list of IPs in your web.config (which sadly will mean a redeploy if you have to modify them). Here is a link to a blog post where someone did this: http://blog.liamcavanagh.com/2011/10/how-to-block-ip-addresses-in-windows-azure/

OTHER TIPS

I never heard of it.

In your global.asax:

        protected void Session_Start()
        {
            if (Request.ServerVariables["REMOTE_ADDR"]!= "ÿour ip address here")
            {
                 Response.StatusCode = 404;
            }
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top