locked
get Page object instance in HttpModule RRS feed

  • Question

  • User-1328805033 posted

    Hi,

    I have a little problem - I don't know hot to create an instance of requested page in HttpModule. I need to modify the header of each requested page from one place (HttpModule should be good for this...). Each page has its header, but I want to add to this header an extra text (eg. site name), so I need to get the header of this page, add extra text and set the page's header to newly composed string.

    Thanks in advance, R.

    Tuesday, June 6, 2006 3:04 AM

All replies

  • User-1675550968 posted

    Hi,

    I have a little problem - I don't know hot to create an instance of requested page in HttpModule. I need to modify the header of each requested page from one place (HttpModule should be good for this...)


    I don`t think it is the best way.... you can`t di this.


    . Each page has its header, but I want to add to this header an extra text (eg. site name), so I need to get the header of this page, add extra text and set the page's header to newly composed string.

    Thanks in advance, R.



    why don`t you just use a Web Custom Control  as header on each page?

    orzeh

    Tuesday, June 6, 2006 4:47 AM
  • User-1624456073 posted
    The best way to accomplish what you're talking about would, in my opinion, be to create a base class for all your pages.

    That is, create a new class, inherit it from System.Web.UI.Page and add the logic there that will modify the header etc, for example by overriding OnLoad or OnInit. Then, make all your .aspx files inherit your new baseclass instead of Page, and voila :)

    Another way to go would be to use a master page.

    Hope that helps!

    Cheers,
    Fredrik
    Tuesday, June 6, 2006 5:54 AM