ASP.NET Web Services in Common Assemblies (DLLs)

We have some ASP.NET stuff (it’s not clearly defined enough to be called a component) that we would like to clear and wrap borders so that we can reuse it. There are actually four parts: some markup, some C # code, some javascript running in the browser, and the webservice method that javascript calls.

One way to clean this device would be to move the markup to a user control, C # to the code control methods for the user control, javascript to a file that will be included in the page using the method code, and web service to the static method in the code. (Assuming, of course, that I can mark the static method in User Control as WebMethod and work with it, which I have not tried yet.)

In any case, the above will not work for us, because we want to create a component that we can include in several projects. And this means that we want the component that we can include in the DLL, which means "Server Management" and not "User Control".

Server management, of course, means no markup. Html needs to be entered on the page using C #. This is not a problem, we did it before. Enabling javascript as a resource and having Server Control in it, inserting it into a page does not seem too complicated. I have not done this yet, but I see many examples of how to do this, so I'm sure I can figure it out.

But part of this, I'm not sure I understand, however, this is a web service. This control will include javascript that will perform callbacks in the web service. The web service will only communicate with Server Control, but it will need to talk to the same database that the web application containing the server control is talking to. That is, this is not a situation where we can configure a single stand-alone web service with which all instances of Server Control will work, we need a separate web service included in each web application that includes server management.

, , DLL, , - DLL. , , , - DLL, , -, -, -. . Server Control - -, . , , , .

, , , ASP.NET 3.5.

?

+3
4

, . , .

, , .NET- - HttpHandler . - web.config, .

, ASP.NET AJAX ScriptResource.axd , . : http://www.microsoft.com/downloads/details.aspx?FamilyId=EF2C1ACC-051A-4FE6-AD72-F3BED8623B43&displaylang=en

+1

- , - -..., , -.

, - ? , ?

0

API -, "", . , JavaScript, WebServices API. , :

  • db- JavsScript
  • , , WebMethod ( EnablePageMethods), db ..
  • JQuery WebService

...

,

jQuery ASP.NET AJAX

0

, - , , , .

, , - , , .

ICallbackEventHandler DLL . javascript, .

, , .

, CallbackEvent , WebMethod. , ( , ) .

-, " ":), , , CallbackEvent, , , . ​​ RaiseCallbackEvent, , ( , ).

Unfortunately, although this is not perfect, this is the best single solution I could come up with to completely wrap all the functionality you describe in a single reusable server control.

Here's a complete source (with a demo) if you're interested.

0
source

Source: https://habr.com/ru/post/1732222/


All Articles