Re: Class Capability Differences

From: Jeff S (Jeff330ci_at_YaNopeSpamhoo.com)
Date: 03/26/04


Date: Fri, 26 Mar 2004 10:36:06 -0800

Thanks for the great explanation. This explains a lot for me.

-Jeff

"Kevin Spencer" <kevin@takempis.com> wrote in message
news:%2394Ad11EEHA.628@TK2MSFTNGP10.phx.gbl...
> > Is it that code-behind modules inherit Page? Is there more to it?
>
> There is. The System.Web.UI.Page class is an HttpHandler; that is, it
> implements the IHttpHandler Interface, because its purpose is to handle
HTTP
> Requests. The HttpHandler is given the entire context in which the HTTP
> Request occurs (This is called the System.Web.HttpContext.Current object).
> The HttpContext contains the Request, Response, Session, Application, and
> other elements of the HttpContext of the current Request as Properties, in
> order to respond. The HttpContext of the current Request is therefore, a
> member by default of the Page class. In custom classes, you need to get a
> handle on the Current HttpContext (which will only occur in the context of
> an HttpRequest) in order to access these objects. This can be done by
> referring to the System.Web.HttpContext.Current object. Once you've done
> that, you can refer to the Application, for example, as
> System.Web.HttpContext.Current.Application.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
>
> "Jeff S" <Jeff330ci@YaNopeSpamhoo.com> wrote in message
> news:#Lxfo80EEHA.1128@TK2MSFTNGP11.phx.gbl...
> > Just wondering why some features are available from the code-behind
class
> > modules (.aspx.cs), and are not available from stand-alone class modules
> > (myClass.cs). For example, accessing the Application state is no problem
> > from a code-behind, but not from a stand-alone module in the same
> assembly.
> > Is it that code-behind modules inherit Page? Is there more to it?
> >
> > Thanks.
> >
> >
>
>



Relevant Pages

  • Re: Common Code Class + Session + Request + Response
    ... the property above allows you to get access to the current request context. ... IHttpHandler Interface, because its purpose is to handle HTTP Requests. ... the HttpContext of the current Request as Properties, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Web.HttpContext.Current.User.Identity.Name is blank
    ... And it is put to the Context on every request i.e user is athenticated with ... forms auth and then in Application_AuthenticateRequest you populate the ... I am asking because HttpContext is recreated ... for every request which means that user details must also. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Web.HttpContext.Current.User.Identity.Name is blank
    ... Yes it is put in the Context on every request in Global.asax.vb ... > forms auth and then in Application_AuthenticateRequest you populate the ... I am asking because HttpContext is recreated ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Class Capability Differences
    ... > Is it that code-behind modules inherit Page? ... The HttpHandler is given the entire context in which the HTTP ... Request occurs. ... The HttpContext contains the Request, Response, Session, Application, and ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Http-handlers
    ... > use an HttpRequest object to get this page on the server locally (will ... originally engineered as an HttpHandler. ... since the HttpHandler becomes the target of the request which ... backward compatibility to allow the .NET ASPX ISAPI to process both ASP ...
    (microsoft.public.dotnet.framework.aspnet.security)