how to Request a resource without requesting a webPage in Asp.Net Application?
-
19-09-2019 - |
Question
We have a Web Application (WebApplication A) which is in place and serving fine, we are working on another WebApplication which will use the Engine of Existing Web Application (WebApplication B) to some extent.
Problem: WebApplication A responds when a http request is made for a resource, like LatestPost.aspx, which passes it down to relevant class / Module like FrontManager.cs. I want to know how can we access that Module / class (FrontManager.cs) from WebApplication B, without requesting a Web Page ?
Solution
Use an HttpHandler. You will need to create a class which implements IHttpHandler and register it in the <httphandlers>
section of the web.config file. These are commonly accessed with a .ashx extension (LatestPost.ashx in your case).
OTHER TIPS
Create a web service, using WCF, to expose the operations of FrontManager.cs.
However, you should try to separate the user-interface aspects of FrontManager.cs from the actual functionality. Expose the raw functionality, with no reference back to user-interface.