VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: [1] ]


Hello, Welcome to this forum for discussing ASP.net/C# Issues. Here you can post your queries/information to share with others/answers.
www.geocities.com/josekonoor

Subject: ASP.Net cookies vs HttpContext (Context.Items.Add())


Author:
Jose Varghese
[ Edit | View ]

Date Posted: 02:51:41 05/20/05 Fri

ASP.Net Cookies Vs HttpContext

HttpContext is normally used when data is needed in memory only at the moment of page transfer. This is the state that lives in HttpContext.Items, which only lasts for the duration of the current request, hence its characteristic of "transient". It's quickly discarded as soon as the current request has finished processing, so it doesn't impose any of the drawbacks you need to care about with Session. So it is better to use HttpContext than cookies to store inter-page state. Cookies are a bad choice for storing state.

But HttpContext will only work in conjunction with Server.Transfer. It will not work using Response.Redirect. The reason why it will not work with Response.Redirect is because Redirect results in another round trip to the client which results in a new HTTP Request and thus a new HTTPContext.

As regards to size of data HttpContext does support more size than cookies. Currently each cookie is limited to a size of 4096 bytes. Context objects allows you the flexibility to pass any kind of object from simple text to heavy objects like dataset which one cant do with cookies. Infact most of the limitations of cookies don't apply to HttpContext.

As regards to performance HttpContext does not make any problem since the request last only for the duration of the current request i.e till the time the next page is loaded. After that the object is no longer accessible and eliminates the cleaning code required in next page like the way it is required in Session.

Adding Items to Context
-----------------------
Context.Items.Add("UserId", txtUserId.Text);

Retrieving Items from Context
-----------------------------
txtUserId.Text = Context.Items["UserId"];
Subject: Bug with Dot Net Winforms (Shortcut Key)


Author:
Jose Varghese
[ Edit | View ]

Date Posted: 07:56:23 08/03/04 Tue

There is a bug with Dot Net Winforms.
The shortcut key given from one winform is invoking the button on another winform.

I reported the same to MSDN and after one month got the reply that 'it has been fixed and will be available in next version'. Till then, u have to search for alternate solutions!

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=509a4eef-f33d-4e32-b6c2-651220d58156
Main index ] [ Archives: [1] ]
[ Contact Forum Admin ]


Forum timezone: GMT-8
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.