Link to home
Start Free TrialLog in
Avatar of loyaliser
loyaliserFlag for United States of America

asked on

.NET custom/user controls, web services and httphandlers

questions on these 4 .NET topics: custom controls, user controls, web services, httphandlers.

pleaes answer all:

1. can't they all, or several of them, be used to basically perform the same task?
2. what really makes them different/unique besides the obvious?
3. what are some simple "real-world" ideas/examples for each one that would illustrate:

a. how they are different, if at all.
b. how they can be used together to perform some kind of simple web solution.

if possible, examples from your own experience with using them would be ideal.

thank you!
ASKER CERTIFIED SOLUTION
Avatar of naveenkohli
naveenkohli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of loyaliser

ASKER

okay...

i understand the UserControl perspective... the idea of making web sites modular - just like the IBuySpy.com sample web site. very neat and clear usage.

clearly, UserControls are being used because it is a matter of new design structure for web sites using ASP.NET. that i understand.

CustomControls and HttpHandlers:

when it comes to CustomControls and custom HttpHandlers, i am at a loss as to what "the motivating factors" are behind using them?

that is my main confusion... when do i know that i need to, or should, use them?

Web Services:

ok... the idea of some internet-based service that returns data to user/server based on some input it receives makes sense... like a news web service that consumes date ranges, and produces news articles in XML format within those date ranges.

but question with this is: can't the same effect be created using Custom or UserControls?

if so, how do i know which of the 3 to use?

thank you.
Avatar of naveenkohli
naveenkohli

As I mentioned earlier, you will use Custom Controls for purposes where the existing web server controls don't serve the puspose. The example I gave of UpDownControls. There is no control in library that will provide this functionality. So the only option you have in that case is develop your own control. Conside them like Owner Drawn controls in MFC where you have to do all the painting your self. Its the same way. In custom controls you will do all the redenring. Another example of custom control is Tree control. There is a web control that serves the purpose. But that onlt works for IE. So for browser independent implementation, you will have to create your own Custom tree view control. And similarly creating Menu controls.

HttpHandlers have nothing to do with server controls. Normally you don't require to implement HttpModules. Like you very rarely create ISAPI extensions. Here is an example from documentation.
-------------
<configuration>
    <system.web>
        <httpHandlers>
           <add verb="*" path="*.jpg"
                type="JpegFileHandler,httpruntime" />
        </httpHandlers>
    </system.web>
</configuration>
---------------
This configuration indicates that if anybody requests a file with extension .jpg, the JpegFileHandler HttpHandler should process the request. And in your processRequest of this httphandler, you can pre-process the information. So If your application plicy does not allow some user to get JPG file, you can end the response there and don't let it get the file.

Then to go a level lower, you can implement HttpModules. They are equivalent to ISAPI filters.

On the same note, WebService have nothing to do with controls.

UserControls are pages initeself. You can assemble other server controls in the user control to build a module so that you can provide uniform look and feel to the site. For example building Header, Footer, TopMenu, LeftMenu, MainBody templates as UserControls. And then on each page you can load these user controls to have same look.

Use CustomControls to enhance functionlity of exsiting server control or develop something that does not exist.


Naveen
good thanks... it is making more sense now...

the techicals are easy to grasp... just needed to get the idea/logic behind these things down, so i'll know what to do with them when the time comes.

thanks.
good thanks... it is making more sense now...

the techicals are easy to grasp... just needed to get the idea/logic behind these things down, so i'll know what to do with them when the time comes.

thanks.