Viewstate Errors

G

Guest

I have an ASP application that works fine locally but when it's uploaded occasionally, I get viewstate errors. Another thing is that the viewstate for that page is disabled. There are cases where I can just refresh the page and it goes through ok

<%@ Page Language="VB" EnableViewState="false" Debug="true" %

The worker threads are set to one, however, it is running on a dual processor web server. The Load Balancer is not installed. What else could it be

How can the page get an invalid viewstate if its is off? Here's the error message that I get

Error page

Server Error in '/Generic' Application
-------------------------------------------------------------------------------

The viewstate is invalid for this page and might be corrupted
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

Exception Details: System.Web.HttpException: The viewstate is invalid for
this page and might be corrupted

Source Error

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below

Stack Trace

[HttpException (0x80004005): The viewstate is invalid for this page and
might be corrupted.
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +15
System.Web.UI.Page.LoadPageViewState() +1
System.Web.UI.Page.ProcessRequestMain() +42

-------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.57

Here's the sourc

<%@ Page Language="VB" EnableViewState="false" Debug="true" %><%@ Register TagPrefix="GJ" TagName="Header" Src="aspx_pagelet/header.ascx" %><%@ Register TagPrefix="GJ" TagName="Menu" Src="aspx_pagelet/menu.ascx" %><%@ Register TagPrefix="GJ" TagName="Banners" Src="aspx_pagelet/banners.ascx" %><script runat="server"
dim LOGINSTATE as boolea
sub RECORDLOGIN(UID as string,CONNSTR as string
dim GJOleDBConnection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(CONNSTR
dim GJCmd as System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand("update wbrg_users set lastlogin='" & now() & "' where userid='" & replace(UID,"'","''") & "'", GJOleDBConnection
GJOleDBConnection.open(
GJCmd.ExecuteNonQuery(
GJCmd.Connection.Close(
end su

sub LOGIN(sender As Object, e As EventArgs
Dim GJDataset As New System.Data.DataSe
Dim GJOleDBConnection As System.Data.OleDb.OleDbConnectio
Dim GJOleDbDataAdapter As System.Data.OleDb.OleDbDataAdapte
GJOleDBConnection = New System.Data.OleDb.OleDbConnection(ConfigurationSettings.AppSettings("USR")
GJOleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter("select userid,comments,pwd from wbrg_users where userid='" & replace(FLD_UI.text,"'","''") & "'", GJOleDBConnection
GJOleDbDataAdapter.Fill(GJDataSet, "LOGINLIST"
GJOleDBConnection.Close(

LOGINSTATE=fals
dim GJDatatable as System.Data.datatabl
dim GJDatarow as System.Data.dataro
dim GJDatacolumn as System.Data.datacolum

for each GJDatatable in GJDataSet.Table
if GJDataTable.Tablename="LOGINLIST" the
for each GJDatarow in GJDatatable.row
if ucase(GJDatarow("pwd").tostring())=ucase(FLD_PS.text) the
LOGINSTATE=tru
session("USERID")=GJDatarow("userid").tostring(
RECORDLOGIN(session("USERID"),ConfigurationSettings.AppSettings("USR")
if request.querystring("op")<>"" the
response.redirect("addtocartops.aspx?op=" & request.querystring("OP") & "&id=" & server.urlencode(request.querystring("id")) & "&st=" & request.querystring("st") & "&vn=" & request.querystring("vn") & "&qt=" & server.urlencode(request.querystring("qt"))
elseif request.querystring("id")<>"" the
response.redirect("addtocart.aspx?id=" & server.urlencode(request.querystring("id")) & "&st=" & request.querystring("st") & "&vn=" & request.querystring("vn") & "&qt=" & server.urlencode(request.querystring("qt"))
elseif request.querystring("pr")<>"" then
response.redirect("myprofile.aspx")
elseif request.querystring("cc")<>"" then
response.redirect("user_ccards.aspx")
elseif request.querystring("AR")<>"" then
response.redirect("user_addresses.aspx")
elseif request.querystring("CK")<>"" then
response.redirect("checkout.aspx")
elseif request.querystring("MO")<>"" then
response.redirect("myorders.aspx")
else
response.redirect("home.aspx")
end if
exit for
end if
next
if session("USERID")="" then
ResPanel.text="<div class=""FRM_MSG"">Log In failed. No records found matching your username and password combination."
ResPanel.text=ResPanel.text & "<br>Use the form below to sign into an existing account or <a href=""createaccount.aspx?id=" & server.urlencode(request.querystring("id")) & "&qt=" & server.urlencode(request.querystring("qt")) & """>click here to register.</a></div>"
end if
end if
next
end sub

Sub Page_Load(sender As Object, e As EventArgs)
if request.querystring("msg")="1" and ispostback=false then
ResPanel.text="<div class=""FRM_MSG"">This transaction requires you to sign in."
ResPanel.text=ResPanel.text & "<br>Use the form below to sign into an existing account or <a href=""createaccount.aspx?id=" & server.urlencode(request.querystring("id")) & "&qt=" & server.urlencode(request.querystring("qt")) & """>click here to register.</a></div>"
end if
End Sub
</script><html><head><title>EasyRiders - Log In</title><link rel="stylesheet" type="text/css" href="css/header.css" /><link rel="stylesheet" type="text/css" href="css/form.css" /><script src="javascript/header.js" language="javascript"></script></head><body><div style="position:absolute;width:100%;z-index:-1;top:200px;text-align:center;filter:fliph();"><img src="aspx_img/vtbike.jpg"></div><form runat="server" method="post"><center><GJ:Header runat="server"/><GJ:Menu runat="server"/><br><asp:label id="ResPanel" runat="server"></asp:label><table cellpadding="0" cellspacing="0" style="width:100%;"><tr><td style="padding-left:20px;padding-right:20px;vertical-align:top"><table class="FRM_CONTAINER" cellspacing="0" cellpadding="0"><tr><td class="FRM_HEADER" colspan="2">Sign In</td></tr><tr><td class="FRM_LABEL" nowrap>User ID: </td><td><asp:textbox class="FRM_ITEM" id="FLD_UI" runat="server" maxlength="255"></asp:textbox></td></tr><tr><td class="FRM_LABEL" nowrap>Password: </td><td><asp:textbox class="FRM_ITEM" id="FLD_PS" runat="server" maxlength="255" textmode="password"></asp:textbox></td></tr><tr><td class="FRM_BTNBAR" nowrap colspan="2" style="padding:10px;"><asp:Button id="BTN_REG" onclick="LOGIN" runat="server" Text="Log In"></asp:Button></td></tr></table></td><td style="vertical-align:top"><GJ:Banners runat="server" PID="LoginPage_01"/><GJ:Banners runat="server" PID="LoginPage_02"/></td></tr></table></center></form></body></html>
 
N

Natty Gur

Hi,

Even if you set ViewState to false your page will store page hash key.
to learn about it and how to workaround refer to :
http://weblogs.asp.net/ngur/archive/2003/12/30/46731.aspx
and
http://weblogs.asp.net/ngur/archive/2004/03/08/85876.aspx

page hash key is used by ASP.NET to ensure that viewstate data belongs
to the current page. you can get invalid viewsate error if :
1) you transfer request to other page.
2) request arrive to server in cluster that don't have same machinekey
as server that create page.

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top