changing rendered page just before it gets to the user

  • Thread starter Thread starter david2tm
  • Start date Start date
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
 
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.
 
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
 
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

}
 
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.
 
Back
Top