473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Viewstate Errors

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.LoadPageStateFromPersistenceMed ium() +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(ConfigurationSet tings.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.te xt) the
LOGINSTATE=tru
session("USERID")=GJDatarow("userid").tostring(
RECORDLOGIN(session("USERID"),ConfigurationSetting s.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>
Nov 18 '05 #1
1 1953
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/.../30/46731.aspx
and
http://weblogs.asp.net/ngur/archive/.../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!
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ersin Gençtürk | last post by:
Server : WEB System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Web.HttpException: The View State is invalid for this page and might be...
2
by: Janaka | last post by:
We have managed to lock down 99% of the application errors occurring in our asp.net sites. The only errors which occur on a regular basis now are viewstate errors. We have disabled viewstate on...
2
by: Max Metral | last post by:
I get sporadic viewstate errors from Macintosh browsers. I get mailed the form values when this happens, and it appears that the problem is the encoding of the POST value from the browser. ...
11
by: Nad | last post by:
Hello, I have a page with two link buttons. When I click on the first one I call server.execute("target.aspx") to view target.aspx on the original page. Then I click on the second link button...
10
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
5
by: Tarun Mistry | last post by:
Hi all, im attempting to use the ViewState instead of the hidden values normally used in procedural web development, however i cant seem to get anything to add into it or load correctly from it. ...
1
by: Tarun Mistry | last post by:
Hi there, is there a simple way to check if something is in the viewstate without getting null pointer errors? I.e. obviously the "exisits" method doesnt exisit, i have just put it there to...
6
by: sck10 | last post by:
Hello, I have applications that produce the following error when they have been open to long without activity. Is there any way to force a re-load of the page or go to another page if the page...
1
by: scottrm | last post by:
Hi We have been getting 2 intermitent errors in the event log detailed below. They are occurring on a server where the web site is stopping responding periodically and needs to be brought back...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.