[C#/OWIN] Where can I create list of banned IP addresses and preload it from SQL for the duration of application?

3    29 Nov 2015 06:55 by u/Karmadilla

I was thinking of putting it in Startup class and making the field static. Loading it somewhere in the Configuration() and then wiring up middleware to it.

2 comments

1

The design of your application depends on what you want tot do with it. There is no single answer.

  • Must that list change during operation?
  • Is that list shared between different threads?
  • Is this a console application? Winforms? WCF service? WPF????
  • Is that banned list huge?
1

Nowhere. As soon as you start checking a client's IP Address against a list, you are crippling your application's ability to scale as well as incur a performance hit on every connection.

Move this to a router/firewall.