You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 6, 2020. It is now read-only.
If a client doesn't properly format the HTTP_X_FORWARDED_FOR request header MvcThrottle.IpAddressParser.ParseIp will throw a System.FormatException.
In these cases, we would rather it just use the IP address of the request. While it's true this is an error on the client's part, if the request is otherwise valid we'd still like to serve something to the user.
I'd suggest returning IPAddress.None:
IPAddress parsedIP;
if (IPAddress.TryParse(ipAddress, out parsedIP))
{
return parsedIP;
} else
{
return IPAddress.None;
}