Session is used to store per-user information for the current Web session on the server. It supports using a database server as the back-end store.
Session["name"] = TextBox1.Text;
string welcomeString = "Hello " + Session["name"];
Cookies are small files saved on client's disc used to store data concerning a concrete user. Cookies are simply bits of software placed on your computer when you browse websites. Websites use cookies so they can track what you are viewing. The website will recognize your computer when you come back to visit again. Cache files help your browser go faster since it caches the files to be used. These are also left behind on your pc and includes everything, including pictures, sound files, video files, and text that you have browsed. If you share your pc in any way, you probably want to keep these cleaned when you get done browsing
It can for example contain some preferences that user have chosen before so later the same preferences can be applied instantly.
Websites send small text files known as cookies to your web browser in order to store information about your connection to their server, including authentication information, details about your online session, and any preferences you may have saved. Cookies are particularly useful when you want a website to auto-sign you into a web service, but like the cache, they could be used to compromise your privacy if someone gained access to your computer.
HttpCookie cookie = new HttpCookie("user");
cookie["name"] = "John";
Response.Cookies.Add(cookie);
Cache object is shared between users in a single application. Its primary purpose is to cache data from a data store and should not be used as a primary storage. It supports automatic invalidation features. If data requested by client actually is in cache then it's called a cache hit. The more cache hits the better because then your application simply works faster. The number of cache hits depends of course on the size of the memory and the implementation of caching.
Browser Cache: In order to speed up web browsing, browsers are designed to download web pages and store them on
your computer in an area called the cache (pronounced cash). When you visit the same page
for a second time, the browser speeds up the display time by loading the pages locally from the
cache instead of downloading everything again.
It can also include login IDs, passwords, banking information,
and other sensitive information. Clearing your cache can significantly improve the speed and performance of your browser and
ensures that anyone who uses the same computer and browser after you (particularly on public
computers) will not see your private information. It's a good habit to clear your cache from time
to time.
Caching Server
A caching server performs functions similar to those of a browser
cache, only on a much larger scale. Where a browser cache is responsible
for storing web objects for a single browser application on a single
machine, a cache server stores web objects for a larger number of
clients or perhaps even an entire network. With a cache server, all web
requests from a network are passed through caching server, which then
will serve the requested files to the client. The cache server can
deliver content either directly from its own cache of objects, or by
retrieving objects from the internet and then serving them to clients.
Cache servers are a more efficient than browser caches as this
network-level caching process makes the object available to all users of
the network once it has been retrieved. With a browser cache, each user
and, in fact, each browser application on a specific client must
maintain a unique cache of files that is not shared with other clients
or applications.
Also, cache servers use additional information provided by the web
server in the headers sent along with each web request. Browser caches
simply re-validate content with each request, confirming that the
content has not been modified since it was last requested.
In ASP.NET there are three types of caching:
- Page Level Caching - it's simply caching whole HTML code of generated page:
<%@ OutputCache Duration="30" VaryByParam="*" %> - Fragment Caching - caching small fragments of your website like for example user controls:
<%@ OutputCache Duration="60" VaryByParam="none" VaryByControl="CategoryDropDownList" %> - Caching Data Objects - allows you to cache objects from your application such as a table for instance :
You can also save data to cache simply by using cache object, it's working like the standard dictionary with key-pairs value. It's best to show this on an example.Cache["name"] = "Steve";Retrieving data is equally simple:
-
if (Cache["name"] != null)
- {
- Label1.Text = Cache["name"].ToString();
- }
A bookmark in a Web browser is essentially the same thing as a bookmark in a book.
It saves the page URL/location, allowing you to come back to it whenever you may need to.
It saves the user from remembering their exact path to finding a certain website or page.
No comments:
Post a Comment