If you have different master pages for each site you should just be able to put some logic in the top of the master template to check the IP and then redirect if it isn't in the whitelist.
This isn't really an Umbraco "thing" - more c#. Remember anything you can do in Razor & C# you can do in a template. so this would work in your Master.
@{
Layout = null;
// i've mixed up IP v4 and v6 here..
string[] whiteListedIPs = { "31.66.58.123", "::1" };
string userIP = HttpContext.Current.Request.UserHostAddress;
if (!whiteListedIPs.Contains(userIP))
{
HttpContext.Current.Response.Redirect("http://www.google.co.uk/");
}
}
Restrict umbraco site
Hello
Umbraco 7.2 with two sites in one Umbraco. No culture or hostname set on either site.
I would like the first site accessible to the public but the second to be limited by IP address. How could i do this?
If you have different master pages for each site you should just be able to put some logic in the top of the master template to check the IP and then redirect if it isn't in the whitelist.
HTH
Steve
Thanks, any examples I could follow? Sorry new with umbraco
Hi,
This isn't really an Umbraco "thing" - more c#. Remember anything you can do in Razor & C# you can do in a template. so this would work in your Master.
Ah I see!! I thought there was an "Umbraco" wat of doing things. Thanks
is working on a reply...