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.Http Context)
Implements System.Web.IHtt pHandler.Proces sRequest
............
context.Respons e.Write("<table border=1 cellpadding=4 bgcolor=orange> ")
context.Respons e.Write("<tr><t d colspan=4 align=center>")
...........
Public ReadOnly Property IsReusable() As Boolean Implements
System.Web.IHtt pHandler.IsReus able
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.Redire ct("TestForm2.a spx") 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.Respon se.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.A dd. In other words, how do I
obtain an instance of this page ?
Thank you.
Alex 2 2519
Alex Nitulescu wrote: 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.Http Context) Implements System.Web.IHtt pHandler.Proces sRequest ........... context.Respons e.Write("<table border=1 cellpadding=4
bgcolor=orange> ") context.Respons e.Write("<tr><t d colspan=4 align=center>") .......... Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHtt pHandler.IsReus able 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.Redire ct("TestForm2.a spx") 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.Respon se.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.A dd. In other words,
how do I obtain an instance of this page ?
If you want Page, then just use ordinary .aspx. I think the http
handler is completely useless since its URL has to end with the ext
".axd", and you could just replace it with a Page with diffenrent
content-type.
It's not easy to load a Page by yourself, because there are many issues
that ASP.NET has to deal with, such as event dispatching, postback, etc.
Alex,
You can take a look at PageParser.GetC ompiledPageInst ance 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.publi c.dotnet.framew ork.aspnet/<et************ **@tk2msftngp13 .phx.gbl>
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.Http Context)
Implements System.Web.IHtt pHandler.Proces sRequest
...........
context.Respons e.Write("<table border=1 cellpadding=4 bgcolor=orange> ")
context.Respons e.Write("<tr><t d colspan=4 align=center>")
..........
Public ReadOnly Property IsReusable() As Boolean Implements
System.Web.IHtt pHandler.IsReus able
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.Redire ct("TestForm2.a spx") 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.Respon se.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.A dd. In other words, how do I
obtain an instance of this page ?
Thank you.
Alex
[microsoft.publi c.dotnet.framew ork.aspnet] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave Bootsma |
last post by:
Is it possible to programatically save a certain image from a certain web
page?
I want to automatically get a specific graphic from a specific web page
programatically so I can automate the task. I know I can NAVIGATE to the
page with the MS web browser control, but at that point I am stumped as to
wether I can even save the page...
TIA
|
by: Andrea Williams |
last post by:
Does anyone know of some in depth documentation regarding how to add user
controls programatically? I have a User Control, which has some basic html
controls, and depending on the number selected in an HtmlSelect control's
value, I need to put x number of forms (or usercontrol) on the page.
I've added the control once to the ASPX, but how do I add more than one when
needed to the page, then how do I rename the form names so that they are...
|
by: stb |
last post by:
I have an empty asp:table on a form.
Rows and cells in the rows are added programatically. At the end of each
row, there is a cell with a button inside it.
How do I catch the button's click event?
dim dr as sqlDataReader
Dim tempCell As TableCell
dr=........
|
by: P. Gruenhagen |
last post by:
I've written several UserControls that contain different versions of a form
that users need to fill out. Depending on which role a user is logged in as,
I load the appropriate UserControl and add it to a panel on my WebForm. So
far, so good. However, when the form is posted back to the server, I'm
getting stuck.
I don't think I want to load the control into the panel again because then
all of the values that were set by the user before...
|
by: Adam |
last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have
developed the handler,
1. installed it into the gac
2. added it to the machine.config:
<httpHandlers>
<add verb="*" path="*.sgf" type="CustomExtensionHandler,
Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=d831d925597c1031" validate="True"/>
</httpHandlers>
| |
by: larry mckay |
last post by:
I'm trying to programatically print the content that is rendered in an
internet explorer control.
if do webbrowser.navigate ("http://www.yahoo.com")
the content of the webpage appears in the browser control.
I'd like to then print the display of the browser control
programatically to a printer.
does anyone have any code samples that can do this?
|
by: Trint Smith |
last post by:
I know that this may belong in the asp group, but I want to
programatically control the web form image control.
For example, I want to let the program choose the image url at load time
and the 'keep perspective' attributes with visual basic .net commands.
Any help is appreciated.
Thanks,
Trint
..Net programmer
trintsmith@hotmail.com
|
by: mike |
last post by:
Hi,
When I programatically Bind a DataSource to DetailsView it does not fire
"ModeChanged" event.
This is first time i am trying to use ASP.NET DetailsView control.
I have played with some of the sample provided by Microsoft and other
comminity sites. Most of the samples were using Databinding using a
DesignTime "SqlDataSource" Control and assigning its ID to DataSourceID
property of DetailsView.
However, in all of my application we DO...
|
by: Author |
last post by:
I followed the example at http://support.microsoft.com/kb/308001/EN-US/
and created my own HttpHandler.
Here is the code:
using System.Web;
namespace MyNameSpace
{
public class SyncHttpHandler: IHttpHandler
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |