Ok, I know the subject doesn't make sense, but I am at the point of ripping my hair out over this. I have a struct which contains other structs (also tag serializable) shown below. I am heavily using Telerik controls in this app and as the user follows this tab driven wizard, information from each tab is added to the TestConfig object in ViewState. This works flawlessly, until... you let the browser sit for 4 or so minutes. If at any point in time you sit on a particular tab and wait the requsite 240+ seconds, when the user clicks next, the debugger throws an InvalidCastException. Here is the interesting part. The cast is a simple return of the object from ViewState (below). The object in ViewState no longer thinks it is a TestConfig object. It will allow me to cast it as an object as it rightfully should and I can even drill down into the object within VS2008 and see all of the data is still there. Somehow it is losing its type and I cannot for the life of me figure it out. I am at the point of either moving to a database solution or if it doesn't make sense to do that, hidden controls, but I would really like to just resolve this the right way. Anyone have any thoughts?
Structs:
[Serializable] public struct TestConfig { public GridData oTestType; public GridData oArchitecture; public GridData oBuild; public GridData oBuildType; public List<GridData> gloLanguages; public List<GridData> gloOperatingSystems; public List<GridData> gloFamilies; public List<TestDriverData> gloTestDriverData; } [Serializable] public struct TestDriverData { public string sPath; public string sModel; public string sModelDisplayString; public string sPort; public string sPdl; public string sPdlDisplayString; public string sFamily; } [Serializable] public struct GridData { public string sDisplay; public string sData; public string sMisc; }
Return Code:
return (TestConfig)ViewState["m_TestConfig"];