Serve ASP.NET control through custom RequestHandler

Discussion in 'ASP .Net' started by Ricky K. Rasmussen, Jun 7, 2004.

  1. Hi NG,

    Is it possible in any way to serve an ASP.NET server control when the
    request is beeing processed by a custom request handler?

    In my case I use my own request handler to serve elements that exists as
    content in a database, and not as files in the file system. What i want is
    to be able to place ASP.NET controls on some of my output, so they can be
    served alongside my requested content.

    I've tried to create a System.Web.UI.Page instance, add a HtmlForm to its
    Controls collection and my ASP.NET control to the HtmlForm. Calling the
    Control or Page RenderControl() method provided me with the initial output
    of the control, but it seams i need to do a little more work than that.

    The Viewstate isn't maintained and the serverside events generated by the
    control cannot be caught.

    Do I need to manually parse the request for viewstate and serverside events?
    Is there a way to do this easily? Or do I end up making my own version of
    the ASP.NET RequestHandler?

    Could anyone point me in the right direction?

    Thanks for your time,
    Ricky
    Ricky K. Rasmussen, Jun 7, 2004
    #1
    1. Advertising

  2. "Ricky K. Rasmussen" <> wrote in message
    news:eyNw%...
    > Hi NG,
    >
    > Is it possible in any way to serve an ASP.NET server control when the
    > request is beeing processed by a custom request handler?
    >
    > In my case I use my own request handler to serve elements that exists as
    > content in a database, and not as files in the file system. What i want is
    > to be able to place ASP.NET controls on some of my output, so they can be
    > served alongside my requested content.
    >
    > I've tried to create a System.Web.UI.Page instance, add a HtmlForm to its
    > Controls collection and my ASP.NET control to the HtmlForm. Calling the
    > Control or Page RenderControl() method provided me with the initial output
    > of the control, but it seams i need to do a little more work than that.
    >
    > The Viewstate isn't maintained and the serverside events generated by the
    > control cannot be caught.
    >
    > Do I need to manually parse the request for viewstate and serverside

    events?
    > Is there a way to do this easily? Or do I end up making my own version of
    > the ASP.NET RequestHandler?
    >
    > Could anyone point me in the right direction?


    If your handler is able to derive from System.Web.UI.Page, then it will _be_
    a page, and everything should work.
    --
    John Saunders
    johnwsaundersiii at hotmail
    John Saunders, Jun 7, 2004
    #2
    1. Advertising

  3. Thanks for your reply John.

    I know that deriving from the System.Web.UI.Page creates a ASP.NET Page that
    can be served throug the ASP.NET RequestHandler. But what I want to do is to
    serve an ASP.NET WebControl throug my own RequestHandler.

    I figure this means that I need to programatically create a
    System.Web.UI.Page with a HtmlForm containing my control, and then serve the
    Page... but how do I do this?

    Calling Page.RenderControl() does only create the initial output and doesn't
    parse the request for server events and viewstate. Is there a way for me to
    make the Page work as if it was served through the ASP.NET RequestHandler?

    Thank you for your time,
    Ricky



    "John Saunders" <> wrote in message
    news:...
    >
    > If your handler is able to derive from System.Web.UI.Page, then it will

    _be_
    > a page, and everything should work.
    > --
    > John Saunders
    > johnwsaundersiii at hotmail
    >
    Ricky K. Rasmussen, Jun 7, 2004
    #3
  4. "Ricky K. Rasmussen" <> wrote in message
    news:...
    > Thanks for your reply John.
    >
    > I know that deriving from the System.Web.UI.Page creates a ASP.NET Page

    that
    > can be served throug the ASP.NET RequestHandler. But what I want to do is

    to
    > serve an ASP.NET WebControl throug my own RequestHandler.
    >
    > I figure this means that I need to programatically create a
    > System.Web.UI.Page with a HtmlForm containing my control, and then serve

    the
    > Page... but how do I do this?
    >
    > Calling Page.RenderControl() does only create the initial output and

    doesn't
    > parse the request for server events and viewstate. Is there a way for me

    to
    > make the Page work as if it was served through the ASP.NET RequestHandler?


    No, I meant that your HttpHandler should _be_ a page:

    public class MyRequestHandler : System.Web.UI.Page
    {
    ....
    }

    --
    John Saunders
    johnwsaundersiii at hotmail
    John Saunders, Jun 7, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c2hla2hhcnRncw==?=

    How to debug an ASP.NET web application residing on a remote serve

    =?Utf-8?B?c2hla2hhcnRncw==?=, Nov 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    346
    Cowboy \(Gregory A. Beamer\)
    Nov 15, 2005
  2. Newbie
    Replies:
    0
    Views:
    328
    Newbie
    Dec 21, 2005
  3. Vitaly Sedov

    IIS doesn't serve ASP.NET Applications

    Vitaly Sedov, Aug 10, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    4,602
    John Timney \(MVP\)
    Aug 11, 2006
  4. jthg
    Replies:
    0
    Views:
    413
  5. Laszlo Nagy
    Replies:
    0
    Views:
    63
    Laszlo Nagy
    Nov 16, 2013
Loading...

Share This Page