c# - How to get around storing a usercontrol out of process in session state -


i attempting store usercontrol in session state between postbacks, using sql stateserver.

i class not serializable error:

unable serialize session state. in 'stateserver' , 'sqlserver' mode, asp.net serialize session state objects, , result non-serializable objects or marshalbyref objects not permitted. same restriction applies if similar serialization done custom session state store in 'custom' mode. 

stack trace

serializationexception: type 'asp.bookingcontrols_controls_ucdates_ascx' in assembly 'app_web_eckjngpu, version=0.0.0.0, culture=neutral, publickeytoken=null' not marked serializable.] 

now, marking usercontorl class serializable, still error. research have determined, far, usercontrol cannot serialized. fine.

the general proposed idea around this, seems to split control (data) control (interface/front end), , rebuild on other side.

now, before attempt make impacting changes code, question following:

will object derived usercontrol class, not created dynamic usercontrol means of page.loadcontrol("control.ascx"), serializable, or have create seperate "accompanying class" store data. if so, assume can not inherit control class properties, inherit usercontrol classes not serializable?

example:

not using:

dim mydatescontrol new usercontrol mydatescontrol = page.loadcontrol("~/bookingcontrols/ucdates.ascx")          ctype(mydatescontrol, controls_ucdates)             .checkindate = session("nowcheckin")             .checkoutdate = session("nowcheckout")             .nights = "xxx"             .guid = currentbookingfilter.guid             .extrainfo = currentbookingfilter         end 

would following work, object serializable out of process session state.

dim mydatescontrol new controls_ucdates          ctype(mydatescontrol, controls_ucdates)             .checkindate = session("nowcheckin")             .checkoutdate = session("nowcheckout")             .nights = "xxx"             .guid = currentbookingfilter.guid             .extrainfo = currentbookingfilter         end 

in second block, mydatescontrol serializable?

nthe end result mydatescontorl class, inheriting usercontrol class, not serialized session state.

i created "accompanying" class , duplicated properties of uc. in code, use accompanying class store state control, , create controls before display, re-reassign properties.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -