2

I have a problem with the Mikrotik API in C#

I locate a logged user on hot spot with this code:

    connection.LoadSingleOrDefault<HotspotActive>(connection.CreateParameter("user", *MyUserName*));

However it works on a case-sensitive basis; how can I make the code case-insensitive?

Thanks.

Gordon Mackie JoanMiro
  • 3,499
  • 3
  • 34
  • 42
Dario
  • 21
  • 2

1 Answers1

0

case sensitivity is the same as with pure mikrotik API (there is no option to workaround it). In this case (expected limited number of hotspot active users) you can load all users and filter them via linq expression in C#.

connection.LoadAll<HotspotActive>()
            .SingleOrDefault(ha => string.Equals(ha.UserName, "*MyUserName*", StringComparison.CurrentCultureIgnoreCase));

Enjoy, D