c# - Reference of an object to a Session property -
i have text box in aspx page, created session property (textbox type), then:
textboxinsession = mytextbox;
if change text property in textboxinsession, text property in mytextbox not changed.
isn't textboxinsession reference mytextbox?
in general, should not persist ui elements/controls session or application state. when store object instance, pin , holds reference in memory. because asp.net creates new instance on each page execution, can result in considerable amounts of memory being consumed non-garbage-collectible page , control instances, if make heavy use of technique.
you should store value types, strings , serializable pocos or business layer types instead, , rebind them ui controls when need them.
Comments
Post a Comment