How to programatically load control in HTTPHandler ?
From: Willie Ferguson (willie.ferguson_at_gmail.com)
Date: 02/03/05
- Next message: Ronen: "Memory Leak in Internet Explorer using Treeview"
- Previous message: Steve C. Orr [MVP, MCSD]: "Re: Can you maintain session state when using Server.Transfer() ?"
- Messages sorted by: [ date ] [ thread ]
To: microsoft.public.dotnet.framework.aspnet Date: Wed, 02 Feb 2005 22:25:36 -0800
Alex,
You can take a look at PageParser.GetCompiledPageInstance which takes the path to the aspx you need to load and return an IHTTPhandler. Call ProcessRequest to execute the aspx page.
Willie
nntp://news.microsoft.com/microsoft.public.dotnet.framework.aspnet/ Hi. I have a web.config which says that all files with the "axd" extension
should by a special handler.
The handler writes some stats to the "axd" page.
Public Class WhosOnHandler
Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As System.Web.HttpContext)
Implements System.Web.IHttpHandler.ProcessRequest
...........
context.Response.Write("<table border=1 cellpadding=4 bgcolor=orange>")
context.Response.Write("<tr><td colspan=4 align=center>")
..........
Public ReadOnly Property IsReusable() As Boolean Implements
System.Web.IHttpHandler.IsReusable
Get
Return True
End Get
End Property
End Class
Note that there *is no* axd aspx page in my project ! Whenever a user
presses on a button named "Stats", the code executes
Response.Redirect("TestForm2.aspx") and the handler detects a call to an AXD
file and takes care of the rest, as above.
My problem is that this axd file looks pretty plain, only with
"context.Response.Write". I have some custom controls which I would like to
load to make this page look consistent with the other pages on this website.
So the question is: how do I programatically load my controls in this
situation? I only have the 'Context' object and I need to somehow get to the
'Page' object to be able to say Page.Controls.Add. In other words, how do I
obtain an instance of this page ?
Thank you.
Alex
[microsoft.public.dotnet.framework.aspnet]
Relevant Pages
... The dll file is in the bin folder and the folder has nt permissions set ... > Elaborate on "load any aspx page". ...
(microsoft.public.dotnet.framework.aspnet)
... When I load the .aspx file that generates the playlist and view it's ... Won't work (mms is not a web server protocol) ...
(microsoft.public.windowsmedia.server)
... Elaborate on "load any aspx page". ... How exactly are you referring or loading it? ...
(microsoft.public.dotnet.framework.aspnet)
... Second time when I load the aspx page, I have kill the aspnet_wp.exe process ... tshah. ...
(microsoft.public.dotnet.framework.aspnet)