Text version of the video
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
All ASP .NET Text Articles
All ASP .NET Slides
All Dot Net and SQL Server Tutorials in English
All Dot Net and SQL Server Tutorials in Arabic
In this video, we will discuss about how webforms are cached based on GET and POST requests. One of my youtube subscribers asked this question, related to Part 120 - Caching mulitple responses for a single web form. Please watch Part 120, from the asp.net video tutorial before proceeding with this video. Link for asp.net tutorial :
We will be using the same example from Part 120 of the asp.net video tutorial, to understand web form caching based on GET and POST requests.
Question asked by the youtube subscriber
When we have set VaryByParam"None", and accessed WebForm1.aspx, the form displayed "All" products as expected. In "Select Product" dropdownlist "All" is selected. Now when I change the selection in the dropdownlist to "iPhone", WebForm1.aspx gets posted back to the server, the form is re-processed. At this point only "iPhone" product is displayed in the gridivew control, and in the dropdownlist "iPhone" is selected.
First Question: Why was the GET request for the webform not cached for "All" products selection in the dropdownlist?
Answer: Actually, the GET request for "All" products selection in the dropdownlist is cached. To retrieve the cached response of the GET request, click any where in the URL address bar in the browser, and press ENTER key. This sends another GET request to the server, which should to return the cached response of the GET request.
Second Question: Why am I not getting the cached response of the GET request when I change the selection in the dropdownlist to "All"?
Answer: This is because, when the selection in the dropdownlist is changed to "All", a POSTBACK request is sent to the server. Since, for the POSTBACK request there is already a cached version of the webform, we get that version. I think, when we set VaryByParam"None", a seperate response is cached for GET and POST requests. I welcome any suggestions to improve this answer. Please leave your valuable comments.