473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What is HttpContext State?

ad
I find a line in a Web application like:
myString=(string)HttpContext.Current.Items["aString"];

I used to use
myString=(string)Application["aString"];
or
myString=(string)ViewState["aString"];

I know about the difference about Application state and ViewState.
But what is the HttpContext statae?

Nov 19 '05 #1
3 2487
Hello ad,

HttpContext.Current is the HttpContext associated with the current request.
The Items property on this object is a collection that you can use to pass
things around for the currently executing request *only*.

So, Application is global to the entire application. ViewState is for the
current page. Session is for the current session. Finally Items is for the
current request.

--
Matt Berther
http://www.mattberther.com
I find a line in a Web application like:
myString=(string)HttpContext.Current.Items["aString"];
I used to use
myString=(string)Application["aString"];
or
myString=(string)ViewState["aString"];
I know about the difference about Application state and ViewState. But
what is the HttpContext statae?


Nov 19 '05 #2
Simply put - its the current request passing through the asp.net pipeline
and the objects that form the request, viewstate etc. forms part of the
request in this context....

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"ad" <ad@wfes.tcc.edu.tw> wrote in message
news:eX**************@TK2MSFTNGP14.phx.gbl...
I find a line in a Web application like:
myString=(string)HttpContext.Current.Items["aString"];

I used to use
myString=(string)Application["aString"];
or
myString=(string)ViewState["aString"];

I know about the difference about Application state and ViewState.
But what is the HttpContext statae?

Nov 19 '05 #3
Ad, I'll answer in both threads

Scott Allen's article on it:
http://odetocode.com/Articles/111.aspx

and mine:
http://openmymind.net/index.aspx?documentId=6#context

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!)
"ad" <ad@wfes.tcc.edu.tw> wrote in message
news:eX**************@TK2MSFTNGP14.phx.gbl...
I find a line in a Web application like:
myString=(string)HttpContext.Current.Items["aString"];

I used to use
myString=(string)Application["aString"];
or
myString=(string)ViewState["aString"];

I know about the difference about Application state and ViewState.
But what is the HttpContext statae?

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nayt Grochowski | last post by:
Does anyone see any problem with the loading a SqlConnection into the System.Web.HttpContextCurrent.Items collection in a Page's Constructor. Then Closing and Disposing of it the OnUnload method? ...
0
by: John | last post by:
I'm trying to create a context object similar to the HttpContext that could be used by business objects independent of the origin or the call (ASP.NET or standalone). So I started out by...
1
by: Ram | last post by:
(I am running .NET Framework 1.1) I have a timer(System.Timers.Timer) running in my Global.asax page. In the timer.elapsed event I am trying to access an object I stored in the Cache....
10
by: Rob Morgan | last post by:
For some reason I can't pass the Context to my remoting object. When I run this the application just shows the thrown exception, it never sends the Context it to the remoting server. If I only...
4
by: Makarand Keer | last post by:
Hi All I have problem in using Threading. I have ASP.NET application in which I am using multithreading to start a process. Now the object instances which are used in this thread access...
1
by: dinosaur8000 | last post by:
Hi, I have two ASP.NET solutions in my website, located in two directories: c:\projects\mainsite -- the main web site solution c:\projects\newmodule -- a module I'm adding on solution My web...
1
by: Dave | last post by:
I'm trying call a couple WebRequests asynchronously using the QueueUserWorkItem, but one thing I noticed is that the HttpContext is null within the asynchronous call. I was using...
7
by: Hardy Wang | last post by:
Hi, I have a web application, code of ASPX page needs to call one static method in another class which does not inherit System.UI.Page class using System.Web; public class Utils { public...
14
by: R.A.M. | last post by:
Hello, I have created ASP.NET project in which I have a file Admin.cs. It contains static class Admin with some methods and properties. The problem is that in property get a reference...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.