Tuesday, 13 August 2013

ASP.NET JSON response without web service

ASP.NET JSON response without web service

I've got an ASP.NET based website that already has the necessary hooks
into my back-end database and I want to write something really simple to
return a small bit of JSON based on a URL parameter. So, for example:
http://example.com/JSON/GetInfo.aspx?prodID=1234
And it would return some JSON with product details for the given ID.
I conceptually know how to do this from any ASPX page but I'm wondering if
this is the right way to do it? (Assuming I would just be writing JSON
back out to the response instead of HTML)
I don't need (or want) a full on .NET web service, just something that I
could call from other pages on my site as well as one of our applications
with a GET request to retrieve the desired info.
In visual studio, when I'm adding a new file what type should I use?

No comments:

Post a Comment