I have a .NET Framework 4.5 ASP.NET web form project in VS 2012.
I added an asmx page to the project for web methods. The web service class is already marked with the [System.Web.Script.Services.ScriptService] attribute. What changes must I do in web.config to make my web methods output in JSON? The client is sending
Accept: application/json but the output of each web method is still in Xml. The current web.config generated by VS 2012 has no <handlers> section.
hc1
Member
199 Points
231 Posts
Output ASMX in JSON in .NET Framework 4.5
Feb 02, 2013 02:24 PM|LINK
I have a .NET Framework 4.5 ASP.NET web form project in VS 2012.
I added an asmx page to the project for web methods. The web service class is already marked with the [System.Web.Script.Services.ScriptService] attribute. What changes must I do in web.config to make my web methods output in JSON? The client is sending Accept: application/json but the output of each web method is still in Xml. The current web.config generated by VS 2012 has no <handlers> section.
Thanks.
Careed
All-Star
18764 Points
3637 Posts
Re: Output ASMX in JSON in .NET Framework 4.5
Feb 02, 2013 03:10 PM|LINK
Look at this:
http://stackoverflow.com/questions/288850/how-to-return-json-from-a-2-0-asmx-web-service
However, since you're using ASP.NET 4.5, why not use Web API instead?
"The oxen are slow, but the earth is patient."