Easy Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a code behind ASP.NET app and on one page I populate a user defined
structure from a database. I would like to pass that populated structure to
another page so I do not need to perform multiple database calls. Is this
possible and if so how?

Ryan
 
There are several possibilities to resolve this issue. ASP.Net has several
state models you can use one is the Session Object and the other is the Cache
Object. The syntax is pretty simple:


Page 1
Session[“Widgetsâ€] = this.widgets;

Page 2
Widget widget = (Widget) Session[“Widgetsâ€];

Page 1
Cache[“Widgetsâ€] = this.widgets;

Page 2
Widget widget = (Widget) Cache [“Widgetsâ€];

The difference in the two is that cache is shared through all sessions and
has several other features and Session is just instanced for that user’s
session.

My Two cents
 
Back
Top