At the elementary school -Um-summaq school- our social science teacher Mr. Mahmoud No'man told us that:the secret of the world evolution
in the last decades is the evolution of the communication technologies all over the world.
I did not find a suitable article describes how Page.Items can help to transfer data from Page to another page .Of course, state management like: Query Strings, session, cache Object, Application and others can help us to do that.
Gets a list of objects stored in the page context, but we will use it here to keep data from ASP.NET page to another page.
Objects added to the Items property are available throughout the lifetime of the page, so you can add objects to the Items property in events early in the page life cycle and access those objects in later events.
Page.Items Vs ViewState ViewState help to save data at the page during multiple posts back of the same page .On the contrary, Page.Items refreshed with each page post back
Using the code
The code scenario is a login page save user name and use Server.Transfere to transfer to another page, where can get the saved user name from the context of the previous page and of course value will be lost with the first post back of the page
In page Login.aspx the Page.Items property save the user name in its dictionary after the user enter user name "Omar" , password "secret" and the user enter login button .
The next page Default.aspx will use the context of the previous page to get the user name and display the user name on the label. And so , you need to save the Page.Items value in the first page load in a session , view state or other methodology you want.
You can use the button to cause a post back and refresh the page and you will notice that an exception will be thrown.