473,394 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Intercepting what ASP.NET renders: how fine-grained?

ASP.NET is a kind of "engine" that takes declarative markup and code and
renders these instructions into presentational forms. And every page is a
class.

With that in mind I'm wondering,

a) how to intercept the rendered output and do further programmatic things
with it;
and
b) how coarse or finely grained the control might be. One could envision the
ASP.NET designers giving you programmatic access to subselections of the
page HTML (e.g. <head> ... </head> <body> ... </body> ). Maybe even a page
hieararchy.

I'm interested in rendering content into various non-HTML forms (pdf, Flash
text, multipart mails) and I'd like the ASP.NET engine to do the hard work
of preprocessing some of this content; these ideas are especially
interesting with the availability of skins, themes, and master pages in
asp.net 2.0.

Barring programmatic access, I suppose I can yank what I want using regular
expressions, but I'm curious if there's a better way.

Thanks,
-KF
Nov 19 '05 #1
4 1368
You could certainly use httphandlers to intercept the outgoing
stream and modify it. This article is a bit off topic but the
code sample does demonostrate how and where to do this:

http://www.eggheadcafe.com/articles/hijacksession.asp

You could also load the rendered output into a DOM
and work with it.

http://www.eggheadcafe.com/articles/parsinghtml.asp

There are a variety of things you could do...

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

<ke*****@u.washington.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
ASP.NET is a kind of "engine" that takes declarative markup and code and
renders these instructions into presentational forms. And every page is a
class.

With that in mind I'm wondering,

a) how to intercept the rendered output and do further programmatic things
with it;
and
b) how coarse or finely grained the control might be. One could envision
the ASP.NET designers giving you programmatic access to subselections of
the page HTML (e.g. <head> ... </head> <body> ... </body> ). Maybe even
a page hieararchy.

I'm interested in rendering content into various non-HTML forms (pdf,
Flash text, multipart mails) and I'd like the ASP.NET engine to do the
hard work of preprocessing some of this content; these ideas are
especially interesting with the availability of skins, themes, and master
pages in asp.net 2.0.

Barring programmatic access, I suppose I can yank what I want using
regular expressions, but I'm curious if there's a better way.

Thanks,
-KF

Nov 19 '05 #2
you can modify the HTML that is rendered to the screen in the "Render"
method of the page.

or if you want to alter the HTML of every page in your application you can
just inherit from a common base page.

you can definatly use regular expressions to change the HTML at this point.

HTH

cheers

martin.

<ke*****@u.washington.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
ASP.NET is a kind of "engine" that takes declarative markup and code and
renders these instructions into presentational forms. And every page is a
class.

With that in mind I'm wondering,

a) how to intercept the rendered output and do further programmatic things
with it;
and
b) how coarse or finely grained the control might be. One could envision
the ASP.NET designers giving you programmatic access to subselections of
the page HTML (e.g. <head> ... </head> <body> ... </body> ). Maybe even
a page hieararchy.

I'm interested in rendering content into various non-HTML forms (pdf,
Flash text, multipart mails) and I'd like the ASP.NET engine to do the
hard work of preprocessing some of this content; these ideas are
especially interesting with the availability of skins, themes, and master
pages in asp.net 2.0.

Barring programmatic access, I suppose I can yank what I want using
regular expressions, but I'm curious if there's a better way.

Thanks,
-KF

Nov 19 '05 #3
the rendered output is just a i/o stream of the html content. you can do
anything you want to it, but you would have to reparse it.

the preRender event is the last change to modifiy in the memory model of the
"parsed" page. only items with a runat=server are parsed into the tree,
everty thiong between server objects is parsed as a literal

image the following html:

<html>
<head>
<link id=link1 runat=server href="foo.css" \>
</head>
<body>
<span id=span1 runat=server><font size=1>hi</font></span>
</body>
</html>

is parsed into 5 controls

l1 = new LiteralControl("<html>\n<head>\n");

link1 = new HtmlGenericControl("link");
link1.ID = "link1"
link1.Attributes.Add("href","foo.css");

l2 = new LiteralControl("</head>\n<body>");

span1 = new HtmlGenericControl("span");
span1.ID = "span1";
span1.InnerHtml = "<font size=1>hi</font>";

l3 = new LiteralControl("</body>\n</head>");

these five controls will be added to the pages Controls collection.

-- bruce (sqlwork.com)
<ke*****@u.washington.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
ASP.NET is a kind of "engine" that takes declarative markup and code and
renders these instructions into presentational forms. And every page is a
class.

With that in mind I'm wondering,

a) how to intercept the rendered output and do further programmatic things
with it;
and
b) how coarse or finely grained the control might be. One could envision
the ASP.NET designers giving you programmatic access to subselections of
the page HTML (e.g. <head> ... </head> <body> ... </body> ). Maybe even
a page hieararchy.

I'm interested in rendering content into various non-HTML forms (pdf,
Flash text, multipart mails) and I'd like the ASP.NET engine to do the
hard work of preprocessing some of this content; these ideas are
especially interesting with the availability of skins, themes, and master
pages in asp.net 2.0.

Barring programmatic access, I suppose I can yank what I want using
regular expressions, but I'm curious if there's a better way.

Thanks,
-KF

Nov 19 '05 #4
In ASP.NET 2.0 this can be done with the new Adapter rendering model. It's
intended to allow external code (the "adapter") control rendering when there
is an alternate client being used (such as a handheld device).

-Brock
DevelopMentor
http://staff.develop.com/ballen
ASP.NET is a kind of "engine" that takes declarative markup and code
and renders these instructions into presentational forms. And every
page is a class.

With that in mind I'm wondering,

a) how to intercept the rendered output and do further programmatic
things
with it;
and
b) how coarse or finely grained the control might be. One could
envision the
ASP.NET designers giving you programmatic access to subselections of
the
page HTML (e.g. <head> ... </head> <body> ... </body> ). Maybe even
a page
hieararchy.
I'm interested in rendering content into various non-HTML forms (pdf,
Flash text, multipart mails) and I'd like the ASP.NET engine to do the
hard work of preprocessing some of this content; these ideas are
especially interesting with the availability of skins, themes, and
master pages in asp.net 2.0.

Barring programmatic access, I suppose I can yank what I want using
regular expressions, but I'm curious if there's a better way.

Thanks,
-KF


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Valery Polyakov | last post by:
I am drawing lines with a semi-transparent color (alpha=100). When these lines intercept, the color becomes more intense. Is there a way to avoid this, so that I would get the same intensity of...
7
by: John | last post by:
Hi, Can anyone point me out how to intercept the keystrokes from a c# application that's not a active window? - intercepting the system wide keystrokes before it hits the target active window? ...
0
by: VMI | last post by:
My Windows datagrid has two columns: one with the data that the user will see (col_X) and the other one (a hidden one: col_sort) that'll be used to sort data. When a user clicks on col_X's column...
3
by: Jason Honn | last post by:
I have an .aspx page that renders fine in IE6, but it does not render properly in Firefox. If I change the extension from .aspx to .htm everything renders just fine in Firefox. The problem I am...
4
by: Curious Coder | last post by:
I have been tasked with a project that I do not think can be accomplished. Our company has an application that runs as an unmanaged ActiveX control on user desktops. It is designed to work with...
5
by: aaa | last post by:
Is there a simple straight forward tool out there for intercepting my SOAP requests so that I can debug the XML that I am sending?
6
by: dpomt | last post by:
I have a quite strange problem with the Menu control. I have ten languages and each language has a SiteMapDataSource and a Menu. For better performance, I am creating a hashtable (language ->...
1
by: jason.m.ho | last post by:
Has anyone run into the problem of firefox 'border-collapse: collapse' rendering a table 1-pixel too far to the left? In IE and Opera it will render fine...Does anyone know if this is a bug? This...
12
by: M.L. | last post by:
When loaded from my hard drive, the webpage I'm working on renders fine on IE6, Firefox 2.0.0.1, and Opera 9.02. However, after uploading it to the web there are 2 images that fail to display on...
0
by: Gabriel Genellina | last post by:
En Thu, 18 Sep 2008 19:24:26 -0300, Robert Dailey <rcdailey@gmail.com> escribió: Why don't you try it yourself? You may replace builtins.print with your own function too. It's not exactly the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.