Need to access the Page object in Global.asax in the PreRequestHandlerExecute
Posted
by Taher
on Stack Overflow
See other posts from Stack Overflow
or by Taher
Published on 2010-05-31T04:29:12Z
Indexed on
2010/05/31
4:32 UTC
Read the original article
Hit count: 471
vb.net
I have a huge website (containing around 5000+) pages. There is a theme functionality in the website where user can choose different colors for their profile. Now i want to use the ASP.net theme feature and put different CSS (for different colors) in the theme folder and in Global.asax i want check the user theme and render appropriate link element with the css. But my problem is, i am not able to access the Page element for adding the link in the page. Here is my code
Dim page As System.Web.UI.Page = TryCast(System.Web.HttpContext.Current.Handler,System.Web.UI.Page)
page.StyleSheetTheme = "Black"
But when i run this code I get a Null reference error.
P.s : My application is very huge so its not possible to have a master page or a base class and inherit it in every page.
Please suggest.
© Stack Overflow or respective owner