modification in redered text

A

Abhi

is there anyway redered html can be checked?
I mean let's say if my aspx redered
<html>
<head></head>
<body>
Hello
</body>
</html>

is there anyway I can check the word Hello and change it to Hi ???

I am talking about checking the redered html out of asp.net
 
W

Will

Have you looked at Page.Controls[0]? I think you can
traverse the document using this. I havn't tried exactly
what you're doing before.

To see it traverse the controls:

Response.Write(Page.Controls[0].ToString()+"<BR>")
Response.Write(Page.Controls[1].ToString()+"<BR>")
Response.Write(Page.Controls[1].Controls[0].ToString()
+"<BR>")

You should see things like:
System.Web.UI.HtmlControls.HtmlGenericControl
System.Web.UI.WebControls.Button

After you know what control it is, then cast it to the
control type and use the controls methods... like:

System.Web.UI.HtmlControls.HtmlGenericControl div1 =
(System.Web.UI.HtmlControls.HtmlGenericControl)
Page.Controls[2].Controls[0];
div1.InnerText.Replace("Hello!","Hi!");

Or for something more broad you could find the <BODY> and
then use:
bodyControl.InnerHtml.Replace("Hello!","Hi!");

Hope this stir up some ideas!
 
S

sourcecode

ok here is what I want.
I have a page index.aspx
currently that page has a word "hello" all over the places.
Currently the word "hello" makes it's way into my test.aspx from various
places (eg. resx files, databases, it's even hard coded most of the places)
Now I want to make that word "hello" to "hi" or maybe in the future the word
"hi" might be replaces to "hello there"

Now I know the application should have been designed in such a way that
these changes should have been made from a database. Well too bad the
designers never though about this. So now what I am thinking is, when
index.aspx is requested there should be something which checks the final
redered html text of the index.aspx and make the replacement and send it to
the client.

I have this feeling that this should be possible. My guess is this has to do
something with API's within IIS that are used to render the final html text?
I need to intercept that... the problem is how can I do it
OR atleast where to start looking for this.

sourcecode
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top