HttpModule and User Controls

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..
 
J

Joe Fawcett

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.
 
J

Joey

hey, thanks for the lead.. by any chance do you know if in an httphandler
the Session becames available?
 
T

Travis75

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top