I know MVC controllers are quite good at serving JSON formatted AJAX requests, but is there any built-in ASP.NET functionality I can use for these type calls from a plain old web forms site?
Use generic web handler. i.e. ashx. These are even faster than MVC actions.
You could use built-in ASP.NET AJAX.
Option 1 - use a web service (if you want the functionality to be reusable):
- create a web service (.asmx) with [ScriptService] attribute,
- add a to your page and add the web service to its Services collection,
- use JavaScript proxy generated by ScriptManager in yor page.
Option 2 - use page methods (if you want the functionality on a single page without creating a web service):
- define static methods in your page, add [WebMethod] attribute to them,
- add a ScriptManager with EnablePageMethods="true",
- use PageMethods object to call these method from JavaScript.
In either case JSON will be used for data transfer.
Here is an extensive tutorial with some code samples.
However, ASP.NET AJAX is often blamed for inefficiency - for instance, JS it generates tends to be rather large. So, if you are concerned with performance, you'd want to test it thoroughly.
You might also have a look at this thread: http://stackoverflow.com/questions/673075/net-ajax-calls-to-asmx-or-aspx-or-ashx
If you've got .NET 3.5 installed on the server, you can take advantage of the JSON serialization tools that ship with the framework.
This uses the DataContractJsonserializer class.