I'm trying to filter out .asmx requests by using
string path = request.Url.AbsolutePath;
return Path.HasExtension(path) && Path.GetExtension(path).Equals(".asmx", StringComparison.InvariantCultureIgnoreCase);
However Path.GetExtension is always returning an empty string on my web service requests. The path for the web service request is along the lines of
https://www.mywebsite.co.uk/webservices/some-service.asmx/SomeMethod
To get around it I'm using
return path.IndexOf(".asmx", StringComparison.InvariantCultureIgnoreCase) >= 0;
But wondered if there was a way of getting Path.GetExtension to work.