[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

Invalid View State error on Pocket PC

Vladimir Lvov

4/10/2002 9:36:00 PM

What is the difference in View State management on a Pocket PC and a desktop
PC?

I have an ASP.Net application that saves a small dataset (1 record) using
the ViewState. It runs without any problem on any desktop PC but crashes on
Pocket PC. The message is
"The View State is invalid for this page and might be corrupted."

Thanks,
Vladimir





2 Answers

Craig Deelsnyder

4/10/2002 10:09:00 PM

0

It's not different, it's that the view state by default is stored via a
hidden field in the form. The problem is the there's a smaller limit on the
size of hidden fields on the PocketPC, and most times you hit it if you
don't tweak your aspx pages.

You need to store the view state some other way. I do it for now using
Session variables. Here's the two methods to override to define this:

Protected Overrides Sub SavePageStateToPersistenceMedium(ByVal viewState As
Object)
Session("MyViewState") = viewState
End Sub

Protected Overrides Function LoadPageStateFromPersistenceMedium() As Object
Return Session("MyViewState")
End Function

Override these in every page (this is where inheritance comes in real handy)
and it should work. I have no problems with it so far, even with multiple
windows, etc., but you may want to find a different way to store. Another
way I've seen is using a LosFormatter object to serialize and save the view
state object (which is really a Triplet) as a String (which is pry what
happens by default) in some other way.

Search for these buzz words in www.deja.com and you'll find examples if the
Session way doesn't fit your needs.



"Vladimir Lvov" <lvov@_DELETE_IT_wrapmation.com> wrote in message
news:eQzKLbM4BHA.2652@tkmsftngp05...
> What is the difference in View State management on a Pocket PC and a
desktop
> PC?
>
> I have an ASP.Net application that saves a small dataset (1 record) using
> the ViewState. It runs without any problem on any desktop PC but crashes
on
> Pocket PC. The message is
> "The View State is invalid for this page and might be corrupted."
>
> Thanks,
> Vladimir
>
>
>
>
>


Vladimir Lvov

4/10/2002 11:27:00 PM

0

Craig,

Thank you, for detailed suggestions.
I'll try to use Session State.

Vladimir

"Craig Deelsnyder" <cdeelsny@yahoo.com> wrote in message
news:u5v70tM4BHA.2144@tkmsftngp07...
> It's not different, it's that the view state by default is stored via a
> hidden field in the form. The problem is the there's a smaller limit on
the
> size of hidden fields on the PocketPC, and most times you hit it if you
> don't tweak your aspx pages.
>
> You need to store the view state some other way. I do it for now using
> Session variables. Here's the two methods to override to define this:
>
> Protected Overrides Sub SavePageStateToPersistenceMedium(ByVal viewState
As
> Object)
> Session("MyViewState") = viewState
> End Sub
>
> Protected Overrides Function LoadPageStateFromPersistenceMedium() As
Object
> Return Session("MyViewState")
> End Function
>
> Override these in every page (this is where inheritance comes in real
handy)
> and it should work. I have no problems with it so far, even with multiple
> windows, etc., but you may want to find a different way to store. Another
> way I've seen is using a LosFormatter object to serialize and save the
view
> state object (which is really a Triplet) as a String (which is pry what
> happens by default) in some other way.
>
> Search for these buzz words in www.deja.com and you'll find examples if
the
> Session way doesn't fit your needs.
>
>
>
> "Vladimir Lvov" <lvov@_DELETE_IT_wrapmation.com> wrote in message
> news:eQzKLbM4BHA.2652@tkmsftngp05...
> > What is the difference in View State management on a Pocket PC and a
> desktop
> > PC?
> >
> > I have an ASP.Net application that saves a small dataset (1 record)
using
> > the ViewState. It runs without any problem on any desktop PC but crashes
> on
> > Pocket PC. The message is
> > "The View State is invalid for this page and might be corrupted."
> >
> > Thanks,
> > Vladimir
> >
> >
> >
> >
> >
>
>