Error On Serializable and ViewState

What is the reason for this Error Message,
The type ‘Northwoods.GoWeb.GoView’ must be marked as Serializable or have a TypeConverter other than ReferenceConverter to be put in viewstate.
I am not using View State…, neither am in Trying to serialize it.
(but i am using this in a Web farm)
any Suggestions?

That’s how ASP.NET saves session state.

Is there a way to solve this. i cant proceed without solving this Error,
Thanks
DA

Maybe I don’t understand what this error really is. Could you describe more precisely what the error message is and where it comes from and what you are trying to do?

OK, <?:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>
I have an application deployed in a web farm. 2 machines share the same application, lets call them Mac1 and Mac2. This application is then is called using the cluster virtual name say http://MAC3/application/ViewPage.aspx. Now as you would expect, chances are that the URL goes to any of the machines MAC2 or MAC2, and for subsequent calls can go to anyone of the 2 machines <o:p></o:p>
This page has a GoView Control. I Generate some Nodes (GoIonicNode with an Image)based on the Data coming from a web service. <o:p></o:p>
1) Some Times it shows the View with the nodes (this is good)<o:p></o:p>
2) Some times it does not display anything (Just a normal image not found Place holder).<o:p></o:p>
3) Sometimes it throws a exception which reads…<o:p></o:p>
The type ‘Northwoods.GoWeb.GoView’ must be marked as Serializable or have a TypeConverter other than ReferenceConverter to be put in viewstate. <o:p></o:p>
4) Some times on a click, there is another view which is displayed. A View that i had visited couple of mouse clicks/selection before. <o:p></o:p>
5) Some times when I Double Click on a node it does not fire the Double click Event. <o:p></o:p>
So in all the View does not work as predicted (as of now but i am sure once you have understood this problem we will find a solution). <o:p></o:p>
If I run this application from a single machine, everything works as expected.<o:p></o:p>
So my question is what part of the View is sent through viewstate. What part is stored in the Session Object and what reference about the Rendered View is stored in the Application domain. <o:p></o:p>
Can we use the GoView control out of the box in a web farm Environment or do we have to do some modifications. <o:p></o:p>
I am Using IE and imageProperty is set to PNG format.<o:p></o:p>
Thanks<o:p></o:p>

<?:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Don Almeida

this is my stack Trace
Stack Trace:

[HttpException (0x80004005): The type 'Northwoods.GoWeb.GoView' must be marked as Serializable or have a TypeConverter other than ReferenceConverter to be put in viewstate.]
   System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object value) +1473
   System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object value) +430
   System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object value) +758
   System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object value) +841
   System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object value) +866
   System.Web.UI.LosFormatter.SerializeInternal(TextWriter output, Object value) +102
   System.Web.UI.Page.OnFormRender(HtmlTextWriter writer, String formUniqueID) +143
    System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextW riter writer) +35
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +262
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +72
   System.Web.UI.Control.Render(HtmlTextWriter writer) +7
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   System.Web.UI.Page.ProcessRequestMain() +1929

The type 'Northwoods.GoWeb.GoView' must be marked as Serializable or have a TypeConverter other than ReferenceConverter to be put in viewstate.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
 

That is really weird. Northwoods.GoWeb.GoView does have the [Serializable] attribute and it implements ISerializable.
Did you set GoView.EnableViewState to true?
However, GoView should not be put into the viewstate. That would be terribly inefficient, sending all the GoView and GoDocument state in the HTML page, in addition to sending the PNG image. Instead the state is maintained in the Session state. This does cause the GoView and GoDocument et al to be serialized when the session state is saved, but I have always believed that that serialization is binary.
FYI, nothing is saved in the Application by the GoDiagram implementation.

No, I have not set GoView.EnableViewState to true, neither have i put it in ViewState. I guess in a web farm environment Session state is giving me a issue. I did find this in my Trace.axd output<?:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

Session state

Session Key

Type

Value

Northwoods.GoWeb.GoViews

System.Collections.Hashtable

System.Collections.Hashtable

I tried finding the values from the Hashtable and found only the name of the View and GoOverview. Trace.axd file also showed that there are requests that are made to GoWebImage.aspx. I guess this page regenerates the View. Is there a way to find how this reconstructs the image and not use the default or is there a method to override this method of view generation. I want to keep this application State less. Even if we have to keep this info in the database (not Sql Server) and then provide it to Gowebimage.aspx to reconstruct the Image. Thanks <?:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Don Almeida

What is the Role of GoWebimage.aspx, Trace.axd shows that it does take a Quesry String. 2 calls are made to this page, once with the Query string of GoView = GoViewName, and second Goview=GoOverviewName.
this page inherits from Northwoods.GoWeb.GoWebImage.

As the GoWebIntro.doc documentation file describes, there’s no portable way to embed an image into an HTML file, so we have to rely on an element which produces an additional request (actually, one per GoView that is in the Page).
How does GoWebImage.aspx produce an image? It gets the view from Session state and streams out the result of GoView.GetBitmap.
The problem is that you can’t have the web app be completely stateless, because the request is different from the whole Page request. I suppose you don’t need to use Session state if you don’t want to though–you could override GoView.FindSessionView and GoView.StoreSessionView and implement the serialization in your own manner, and reimplement GoWebImage.OnLoad in a compatible fashion. Doing this properly, though, will require session-like management of the objects, to avoid garbage generation.
For example, if you didn’t need to save any state for a GoView/GoDocument when the user clicked on a view, you might just generate an image that is stored on disk and referenced by the rendered element. But then you still need to delete those image files after a while. And you’ll note that the web app is still stateful–the state is just stored on disk as image files.
As a related topic, I might as well mention that there is a lot of behavior that GoView.RaisePostBackEvent can handle via query strings. GoWebImage can also handle those query strings, which is how a GoView.NoPost view can work to avoid having to do a postback and force the whole page to be regenerated/transmitted. Both GoOverview and GoPalette are implemented this way, which avoids a lot of postbacks and flickering.

Walter,
Thank you very much, I guess I have found a direction now.
have a great day…