Last post May 23, 2007 09:57 PM by Rex Lin - MSFT
May 21, 2007 02:24 AM|alimh76|LINK
i have a problem, i use a IHttpModule to process some request in my asp.net website.
thus i need to change css of page dynamically and i do this with some code in page shown is below:
now i want to change css from iHttpModule.BeginRequest and i cant find any way to access Page object.
can you please help me?
May 22, 2007 11:33 PM|Rex Lin - MSFT|LINK
I recommend you to use HttpHandler to dynamically change the CSS variable.
I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance
May 23, 2007 06:42 AM|alimh76|LINK
thanks for your heeds :-)
that article is great and help me but it seems as though describ how change CSS value dynamically, my CSS is a big file and i think changing all values is too long, rather than i create two CSS and want to change it dynamically, so i need access to sender page
object in HTTPModule.
May 23, 2007 09:57 PM|Rex Lin - MSFT|LINK
Hi, Ali Mohammadi
I believe you can not access the page object in a HttpModule:
After the HttpApplication object massages the request, it pushes the request through one or more HttpModule objects. There are a number of system-level HTTP modules, providing services ranging from authentication to state management to output caching. The
number of modules that get to intercept the request is based upon settings within the host machine's machine.config file and the application's web.config file. In classic ASP, this role of providing pre- and post-processing fell upon ISAPI filters. It turns
out that ASP HTTP modules are more straightforward to write.
The final piece of the chain is the HttpHandler. If you've been working with ASP.NET for a while, you're familiar with the System.Web.UI.Page class. The Page class is an HttpHandler object, implementing the interface IHttpHandler. Classes implementing IHttpHandler
can hook into the HTTP pipeline and service requests through the interface's ProcessRequest method.
So HTTPModules can take the request and do anything to it before a Page object is created and used.