HttpModule and User Controls

  • Thread starter Thread starter Joey
  • Start date Start date
J

Joey

Hi,

i wish i could load up a UserControl from an HttpModule and render it to the
client without needing to go to an aspx page. don't know if this is
possible, i tried instantiating a user control and calling its RenderControl
method passing the Response.OutputStream as a parameter, but it doesn't do
anything.

i do not want to have fancy functionality like postbacks or anything once
the control is rendered. i just need this to display a list of error
messages contained in a dataset easily to the screen.

i know i probably should be using xslt to do this, since its just a display
issue, but using a user control with a datagrid control seemd such an easy
way of doing it...

i'm using ASP.NET 1.1 by the way..
 
Joey said:
Hi,

i wish i could load up a UserControl from an HttpModule and render it to
the client without needing to go to an aspx page. don't know if this is
possible, i tried instantiating a user control and calling its
RenderControl method passing the Response.OutputStream as a parameter, but
it doesn't do anything.

i do not want to have fancy functionality like postbacks or anything once
the control is rendered. i just need this to display a list of error
messages contained in a dataset easily to the screen.

i know i probably should be using xslt to do this, since its just a
display issue, but using a user control with a datagrid control seemd such
an easy way of doing it...

i'm using ASP.NET 1.1 by the way..
A user control needs some sort of container. If you just want a simple
output without overhead implement a custom handler. Look for IHttpHandler
and ashx to get started.
 
hey, thanks for the lead.. by any chance do you know if in an httphandler
the Session becames available?
 
You can access session in PostAcquireRequestState
(context.PostAcquireRequestState +=new
EventHandler(context_PostAcquireRequestState))

If you need to store something prior to this event (like in BeginRequest),
you can store the object/data in Application (context.Application). In
PostAcquireRequestState, copy the object/data from Application to Session.
 
Back
Top