0

I want to restrict access to my MVC project to a predetermined set of IP addresses. It should be quick and easy to add or remove IP addresses, possibly through an admin-interface on the webpage.

Which way would be best to implement this? Do i have to set the restriction in the web.config?

tereško
  • 58,060
  • 25
  • 98
  • 150
Lord Vermillion
  • 5,264
  • 20
  • 69
  • 109

1 Answers1

2

You can set this in IIS, no need to do this specifically in ASP.NET MVC.

See MSDN on a complete how to do this.

If you do want to do this in MVC on a fine grained way for specific actions for example, you can create an own FilterAttribute to determine if the ip address for that action is authorized.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325