renakre
renakre

Reputation: 8291

what is the common practice in organizing PageMethods for Ajax calls

I have been using PageMethods in develping asp.net c# applications for a long time.

I realized that sometimes I have to call the same method from different pages, and copy and paste the same method to those pages.

This definitely creates redundancy problems, I know.

Would it be fine to create a separate *aspx pages just for hosting the related PageMethods.

What is the common practice in this?

Upvotes: 0

Views: 49

Answers (1)

Stilgar
Stilgar

Reputation: 23571

I would recommend that you switch to AJAX-enabled WCF Service. It requires a bit more configuration but once you get it working for one service you can copy/paste it for another. At this point you add the proxy JS to your page and use it pretty much the same way you use PageMethods. Of course there are multiple other ways to do AJAX but I AJAX-enabled WCF services are almost drop-in replacement for Page Methods... almost.

Upvotes: 1

Related Questions