开发者

differences between doing ajax using a page method, a web service and a custom http handler

I'm looking to create json objects in the client and then transfer these objects back to the server for processing. These are the following options I'm considering:

  • a page method

  • a web service

  • a custom http handler

I'm looking to use jquery to send the objects. The plan is to convert the json object into c# objects that in turn go into queries. During the processing, I'll need access开发者_JS百科 to the users' session that's working in SQL server session mode. The pages where these calls will be running will be on https. The return objects will also be json objects. I'll consider scalability, security and performance.

I was wondering what would be the ups/downs of using each option.

Thanks for your suggestions.


This is my order of preference:

  • web service
  • httpHandler (asp.net web services are httpHandlers behind the scenes)
  • page method

Web service gives the maximum flexibility and scalability. ASP.Net web services are in fact HttpHandlers conforming to XML/SOAP standards.

Page Methods are least flexible. They best for one off communication between a piece of javascript with the aspx page. Even then, you have better ways to handle that rather than going through a page method.

Here are few benefits of using a web service:

  • Standards based
  • Provide loose coupling between systems
  • Can be scaled easily
  • Provide greater security as you can implement security at many levels (Authorization, Authentication wise)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜