Weird PathInfo behaviour

This post is about an quirk and its solution (kinda).

It’s a known fact that WebMethods as provided by the AJAX framework use what’s known as the path info of a url in order to map a request to a Web method. In other words, suppose you need to call a WebMethod called AWebMethod() in page APage.aspx. Suppose your application resides in (I really spent some time thinking about proper names about these. Really).

Now, in order to call that particular WebMethod in you need to use the quirky path info method/trick/way (contrast that with the much more sense making controller-mapped actions of any MVC pattern), such as:

See the /AWebMethod thingie there? The framework is smart enough to detect that APage.aspx segment before the /AWebMethod one and figure out that the first one is a file name, so the second one has to be an additional argument, in the way Querystring and URL fragment identifier are. I’m not sure if the URI’s formal specification actually supports this, since it’s been entirely possible to have a directory with a file extension in Microsoft’s OSes since the DOS era (it goes without saying in Unix-based OSes), the above path could easily have been a directory.


So, what’s the problem?

Just a moment, I need to add a little bit of context to the above. Now, in, the HttpRequest object which represents the current request, has the following two properties (amongst others):


FilePath gives you the path of the file in a request, without the Querystring, the scheme or the host parts. In the example I used above, FilePath would give /APage.aspx. PathInfo should return AWebMethod. Well, imagine my surprise when FilePath returned /APage.aspx/AWebMethod and PathInfo returned an empty string.

Try as I might, I couldn’t find any useful information on the matter, apart from the fact that this behavior changed between betas of .net framework v4.0. We are using v4.0 indeed, but that still made no sense, as this certainly wasn’t the beta version.

Instinctively, I performed a Windows Update on the server. After the updates were completed and it did reboot, it started working properly. Naturally, I had a look on the list of the installed updates, but nothing really seemed to apply to my case.


I still have no idea why this worked. Basically, I have no idea why it didn’t work the first time, but there you go. Update your servers regularly.

Click to access the login or register cheese