changing rendered page just before it gets to the user

D

david2tm

hello)

i have some task to coplete, and cant find any way how to do it

in my asp.net (2.0 c#) i do some work, rendering pages...
in those pages, are url's presented, writen in some manner... let say

* "~/somepage.aspx"
* "^/somepage2.aspx"

now, i want to change this

"~" to a server url like "http://www.example.com"
and "^" to "http://www.test.com", let's say

so, i think it will be good to it after the page was rendered, just
before sending it the client
how to catch that page

globaly, not onle fot single page

....thanx
 
B

Baski

One idea would be drive all your page from your custom page class, and then
override prerender method in your custom class , look for your filename and
make your changes.
 
D

david_tm

thanx
it's like i do it now
...but
i need to rewrite every text file wich comes from server...
i mean, for *.css, *.js and *.htc
 
B

Baski

I just thougt another idea, you can do that in java script also, in your
custom base page class's page load method, call the javascript function as
shown below

Page.RegisterStartupScript("StartupScript", "ReplaceURL()");

the java script function will be called as shown as page is render to the
client

inside your ReplaceURL javascript,

Find all the link and replace their value. You can use the method names
var linkCtrls = getElementsByTagName("LINK"); // in java script to get all
your link names.

for(var i in linkCtrls)

{

linkCtrls.value = do yoour replace ment here

}
 
D

david_tm

thanx for yout replies...
it's still will not help me with the other taxt files (not html pages)

for now, i wrote httphandler to deal with *.css, *.js and *.htc
and another renderer is used for *.aspx

but i wanted to use one global method for all taht

I just thougt another idea, you can do that in java script also, in your
custom base page class's page load method, call the javascript function as
shown below

Page.RegisterStartupScript("StartupScript", "ReplaceURL()");

the java script function will be called as shown as page is render to the
client

inside your ReplaceURL javascript,

Find all the link and replace their value. You can use the method names
var linkCtrls = getElementsByTagName("LINK"); // in java script to get all
your link names.

for(var i in linkCtrls)

{

linkCtrls.value = do yoour replace ment here

}


One idea would be drive all your page from your custom page class, and
then override prerender method in your custom class , look for your
filename and make your changes.
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top