3

I know that Web Methods are light weight and gives you speed since there is no post back. I found that a Web Method can be added to a .aspx.cs just like in .asmx.cs web service file. Is there any difference ? Any advantage or disadvantage of doing or not doing so? Or are they just two ways of doing same thing?

SamuraiJack
  • 5,131
  • 15
  • 89
  • 195
  • http://stackoverflow.com/questions/3952400/difference-between-webservice-web-methods-server-side-code – Mahmoud Darwish Jul 15 '13 at 01:15
  • @MEYWD i have been to that link , and that does not answer my question. Question is that is there any difference/advantage/disadvantage in using web method in aspx.cs over web method in asmx.cs? – SamuraiJack Jul 15 '13 at 06:37
  • well, there are advantages/disadvantages mentioned in the answer for example; web services disadvantage is not light weight because of xml, and advantage is being compatible with other platforms languages, and you can consider these the opposite in web methods case, web methods are light weight - depending on your implementation - but are not compatible with other languages as unless you use a common interface as xml which make it the same as a web service – Mahmoud Darwish Jul 15 '13 at 06:47

1 Answers1

0

You often have methods that are logically dedicated to specific ASPX pages, and you don't really want them to be exposed to the public through the ASMX file. Generally, this is the most appealing reason why you want to place web methods in ASPX pages.

Bose_geek
  • 498
  • 5
  • 18