opserver / Opserver

Stack Exchange's Monitoring System
https://opserver.github.io/Opserver/
MIT License
4.5k stars 827 forks source link

In /about/caches, JSON for SQL Server named instances returns 404 #304

Open SQLSourcerer opened 6 years ago

SQLSourcerer commented 6 years ago

When I have a named instance of SQL Server (i.e. name contains a backslash) and attempt to inspect the JSON for its caches in /about/caches, I get the 404 - Not Found page.

I tried changing the link on About.Caches.cshtml to use the new UrlPathEncode extension method. But apparently, that still wasn't enough to get the routing on JsonCache in DataController.cs to pick it up.

NickCraver commented 6 years ago

This should be resolved in latest - can you give it a try please?

SQLSourcerer commented 6 years ago

No luck. I should clarify that I'm trying to get to the JSON for a particular cache, so ParentMemberName doesn't seem to be what was tripping it up. The path that's not finding its way into the JsonCache method in DataController looks like this: /json/SQL/SERVERNAME%5CINSTANCENAME/Databases

It seems to particularly dislike the backslash character in the path, even encoded. It happens on all the browsers I tried it on, so I suspect it's either IIS or ASP.NET MVC's routing engine that objects. One thing I tried was replacing the backslash with another character like ¤ before the UrlEncode. That gets it through the routing pipeline. Of course, then the replacement has to undone inside JsonCache.