Please, can you explain me what is the difference between HttpContext.Current.Response/Request And Page.Request/Response.
Thank you
Item” data is live for single HTTP request/Response where HttpContext. Current. Session data is live throughout user's session.
There is no difference. The getter for Page. Session returns the context session.
HttpRequest is a subset of HttpContext . In other words, the HttpContext includes the response, the request, and various other data that's not relevant to a specific request or response; such as the web application, cached data, server settings and variables, session state, the authenticated user, etc.
The static property Current on the HttpContext class can be useful whenever the flow of control leaves the code in your Page derived web form. Using this property you can reach out and magically grab the current Request, Response, Session, and Application objects (and more) for the request you are servicing.
None whatsoever.
The latter is shorthand for the former.
It's especially convenient when writing ASPX pages; because these pages inherit Page
, you can just write Request
or Response
.
Similarly, Page.Context
is short for HttpContext.Current
.
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