user372079
user372079

Reputation: 123

webservice that returns JSON data

I have tiered of Googling but did't get any clue for myself. I want to make a web service which will have any method (let say-ProductInfo) & when i pass a productId in this method this will return the entire information of Product(like-ProdName,ProdPrice etc) in JSON format(File is downloaded with the Information of product).

I am very new ....so please guide me as a beginner for the above. for any kind of help Millions of Thanks.

Upvotes: 1

Views: 745

Answers (2)

Jirapong
Jirapong

Reputation: 24256

Base on your tag. I guess you use ASP.NET MVC. however, it you mean class ASP.NET then you might need to use WCF-REST to return JSON.

So: for you starting point

  • ASP.NET MVC - look at JsonResult here >>
  • ASP.NET - look at WCF-RESThere >>

Or if you are very new and don't know where to start, I'm recommended you to start at ASP.NET MVC 2

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1039438

For WCF (which is the recommended way of developing web service on .NET) you may take a look at this article for an example of developing a web service exposing JSON data.

For plain old ASMX services you could use the [ScriptService] attribute. Here's another article which illustrates the concept with an example.

Upvotes: 1

Related Questions