468,291 Members | 1,415 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,291 developers. It's quick & easy.

httpcontext and httpapplication

can someone tell me the difference between the httpcontext and
httpapplication object, they seems to have similar methods, such as
getting the Response, REquest, Server variables, are there times when
one should be used as opposed to the other?

Nov 19 '05 #1
1 1749
Request/Server/Session are the same.

HttpApplication actually uses the context to return them...
Here's the code for the HttpApplication.Request

public HttpRequest Request
{
get
{
HttpRequest request1 = null;
if ((this._context != null) && !this._hideRequestResponse)
{
request1 = this._context.Request;
}
if (request1 == null)
{
throw new
HttpException(HttpRuntime.FormatResourceString("Re quest_not_available"));
}
return request1;
}
}
When you are in a page/usercontrol...just use Request and Response no need
to use Application.Request and HttpContext.Current.Request. They are
properties exposed by the Control class.

when you are in a non-control class, use
HttpContext.Current.Request/Response/....

Other than that, they do offer different functionality. They also offer
different storage capabilities, to learn more about it, check out:
http://openmymind.net/index.aspx?documentId=6 (which only talk about their
storage differences)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"phil2phil" <ph*********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
can someone tell me the difference between the httpcontext and
httpapplication object, they seems to have similar methods, such as
getting the Response, REquest, Server variables, are there times when
one should be used as opposed to the other?

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Fernando Arámburu | last post: by
2 posts views Thread by Luis Esteban Valencia Muñoz | last post: by
5 posts views Thread by miha.valencic | last post: by
15 posts views Thread by James Higgs | last post: by
reply views Thread by Aaron Morton | last post: by
6 posts views Thread by =?Utf-8?B?Q2h1Y2sgUA==?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.