IHttpModule Things I have noticed

Something I have learnt today whilst playing with IHttpModule is that when the Init method is called you shouldn’t access the Context method the HttpAplication exposes because it seems like it is not fully constructed (things like the HttpMethod, QueryString and Form properties are not created).However, if you handle an event like such:context.BeginRequest += new EventHandler(Context_BeginRequest);then once you enter the EventHandler, the Context Object (attached to the source parameter) seems to be fully constructed.


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan

<p>Something I have learnt today whilst playing with <a href="http://technorati.com/tag/IHttpModule/tag" rel="tag">IHttpModule</a> is that when the Init method is called you shouldn't access the Context method the HttpAplication exposes because it seems like it is not fully constructed (things like the HttpMethod, QueryString and Form properties are not created).<p />However, if you handle an event like such:<p /><span style="FONT-SIZE: 85%;">context.BeginRequest += <span style="COLOR: #3366ff;">new</span> EventHandler(Context_BeginRequest);</span><p />then once you enter the EventHandler, the Context Object (attached to the source parameter) seems to be fully constructed.<p /><span style="FONT-SIZE: 85%;"><span style="COLOR: #3333ff;">private</span> void Context_BeginRequest(<span style="COLOR: #6633ff;">object</span> sender, EventArgs e){_context = ((HttpApplication)sender).Context;</span><p /></p>


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan


Print Share Comment Cite Upload Translate Updates
APA

Paul Kinlan | Sciencx (2005-05-29T00:00:00+00:00) IHttpModule Things I have noticed. Retrieved from https://www.scien.cx/2005/05/29/ihttpmodule-things-i-have-noticed/

MLA
" » IHttpModule Things I have noticed." Paul Kinlan | Sciencx - Sunday May 29, 2005, https://www.scien.cx/2005/05/29/ihttpmodule-things-i-have-noticed/
HARVARD
Paul Kinlan | Sciencx Sunday May 29, 2005 » IHttpModule Things I have noticed., viewed ,<https://www.scien.cx/2005/05/29/ihttpmodule-things-i-have-noticed/>
VANCOUVER
Paul Kinlan | Sciencx - » IHttpModule Things I have noticed. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2005/05/29/ihttpmodule-things-i-have-noticed/
CHICAGO
" » IHttpModule Things I have noticed." Paul Kinlan | Sciencx - Accessed . https://www.scien.cx/2005/05/29/ihttpmodule-things-i-have-noticed/
IEEE
" » IHttpModule Things I have noticed." Paul Kinlan | Sciencx [Online]. Available: https://www.scien.cx/2005/05/29/ihttpmodule-things-i-have-noticed/. [Accessed: ]
rf:citation
» IHttpModule Things I have noticed | Paul Kinlan | Sciencx | https://www.scien.cx/2005/05/29/ihttpmodule-things-i-have-noticed/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.