Globally log exceptions from ASP.NET [ScriptService] services

I’m using the [System.Web.Script.Services.ScriptService] tag to use web services callable from client side javascript. What I need is a way of globally logging any unhandled exceptions in those methods. On the client side, I get the error callback and can proceed from there, but I need a server-side catch to log the exception.

The guy at this url:

suggests that this can’t be done.

Is that accurate? Do I seriously have to go to every single webmethod in the entire system and try/catch the method as a whole.

C# Using Substring, how do I extract this string?

I want to extract the first folder in the URL below, in this example it is called ‘extractThisFolderName’ but the folder could have any name and be any length. With this in mind how can I use substring to extract the first folder name?

The string:

String folderName = path.Substring(path.IndexOf(@"/"),XXXXXXXXXXX);

It’s the length I’m struggling with.