Restrict view to specific IP address

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 лет назад
Hi,

I have a plugin were I would like to restrict specific views to only the allowed ip address is there a way to do this?

I have implemented this example
http://randyburden.com/blog/2011/08/09/restrict-access-to-an-mvc-action-or-controller-by-ip-address-using-a-custom-action-filter/

but I keep getting a null ref exception when I use it. Anybody got any ideas?

Thank you
8 лет назад


if ( _webHelper.GetCurrentIpAddress() == "11.111.111.111")
return view
else
return null
8 лет назад
Thank you very much for that.

My solution was simple. I added a custom setting to nopcommerce with a list of ipaddreses then, I just used that function to deny or allow access.

Thanks again.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.