Basically, if I have a method (or several methods) that I want to expose to multiple applications, what is the best way to get these to be callable via a jQuery Ajax request? I’d rather avoid having to copy and paste these methods into an ASHX or something somewhere in every project that requires the functionality.
For example, I have a method that looks up a city and state based on the postal code. I’d like to call this method from a shared DLL and not have to copy the method or add a method that simply wraps the call to that DLL to every project that requires the lookup functionality.
Should I have some kind of generic “utilities” web service? That seems like a hackish approach too since it’s not really a web service providing an API but just a group of commonly-used methods.
This is with ASP.NET WebForms, not MVC.
Even with the web service you would have to duplicate the code to call said service from each application. I would think the same would be true with the MVC application approach but not sure about that.
For me I would just used a shared dll (or service depending on requirements). Yes you would have to duplicate the code to call that dll from each app but I think it greatly simplifies what you’re trying to do. That’s how I tend to view common libraries anyway.