Are the HttpContext.Current.Items
lost when a Server.Transfer();
occurs?
If so what is the best way for me to send information to another page without going through the Session?
What is HttpContext? It holds the current information about the Http request. It contains the information like authorization, authentication, request, response, session, items, users, formOptions, etc. Every HTTP request creates a new object of HttpContext with current information.
An HttpContext object will encapsulate specific details of a single HTTP request. Properties of this class include the Request object, the Response object, the Session object, and an AllErrors property which keeps an array of Exception objects accrued during the current request.
The HttpContext is NOT thread safe, accessing it from multiple threads can result in exceptions, data corruption and generally unpredictable results.
An ASP.NET application that has session state enabled. A Web Forms page class that has access to the Page. Session property, or any class that has access to the HttpContext.
Yes, the context would still be valid. It would become invalid or break if you use Response.Redirect().
See article The HttpContext Items Collection
You can access Page.PreviousPage property with all data on it when using Server.Transfer(). And also yes, context would be valid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With