I'm having some issues with an Invalid Viewstate error and I can understand why it's happening but I don't know how to fix it.
I have a page which is similar to this /story/?id=123
but I'm using a different page to Server.Transfer
to this page.
So I've set up /info
to Server.TransferRequest("/story/?id=123")
and it works fine until the page does a postback to itself.
We have a login form on this page which simply reloads the page but when it does it seems to add /?id=123
onto the end of the URL so it ends up like this /info/?id=123
thus causing an Invalid Viewstate error.
I've already tried adding EnableViewStateMac="false"
- this fixes the error but it doesn't log the user in as expected so it does not give the required result.
So my questions are:
Is there a better way to redirect to my page other than
Server.TransferRequest
but still keeping the nice URL? - I don't want toResponse.Redirect
if I can avoid it.If not, is there an easy way to fix this error that doesn't require me adding
EnableViewStateMac="false"
?
http://support.microsoft.com/kb/316920
I believe that article will explain why you are having the problem and it gives a solution to fix it.
I know you don't want to use Response.Redirect, but I think that would also solve the problem.