473,473 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

"View State Invalid" Error While Submitting Form thru JavaScript

Hi Team,

When I tryed following code, I am getting the Runtime Error as
"The View State is invalid for this page and might be corrupted."
Exception Details: System.Web.HttpException: The View State is invalid for
this page and might be corrupted.
Stack Trace:
[HttpException (0x80004005): The View State is invalid for this page and
might be corrupted.]
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +150
System.Web.UI.Page.LoadPageViewState() +16
System.Web.UI.Page.ProcessRequestMain() +421

And My Code is in ".js" file:
function save()

{

document.forms(0).method = "post";

document.forms(0).action = "formsave1.aspx";

document.forms(0).submit();

}

Please let me know wat can be the reason.

Thanks in advance..

cheers !!
Nov 18 '05 #1
2 3171
If you change the action attribute of the form then the Viewstate will
become invalid, you will be posting back data to a different place. The
idea with a webform is that it is always posted back to itself, viewstate is
loaded so your page knows when to run onchange, onclick.. etc server side
events. If you postback to a different page then there would be no way of
knowing if the controls would be the same (and if they were what would be
the point of having a separate webform anyway).

Hope that helps you solves your problem, the only time I can think of that
you would want to overwrite the action attribute using Javascript is if you
have made a previous call to Context.Rewritepath in an HttpModule. You
could then use Javascript to correct the incorrect action attribute that is
output by ASP.net, which causes exactly the same error you are seeing.

Matt
http://www.3internet.com
Inigo Content Management - c# asp.net cms
"Vinod I" <Vi****@PMAM.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
Hi Team,

When I tryed following code, I am getting the Runtime Error as
"The View State is invalid for this page and might be corrupted."
Exception Details: System.Web.HttpException: The View State is invalid for
this page and might be corrupted.
Stack Trace:
[HttpException (0x80004005): The View State is invalid for this page and
might be corrupted.]
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +150
System.Web.UI.Page.LoadPageViewState() +16
System.Web.UI.Page.ProcessRequestMain() +421

And My Code is in ".js" file:
function save()

{

document.forms(0).method = "post";

document.forms(0).action = "formsave1.aspx";

document.forms(0).submit();

}

Please let me know wat can be the reason.

Thanks in advance..

cheers !!

Nov 18 '05 #2
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Vinod I" <Vi****@PMAM.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
Hi Team,

When I tryed following code, I am getting the Runtime Error as
"The View State is invalid for this page and might be corrupted."
Exception Details: System.Web.HttpException: The View State is invalid for
this page and might be corrupted.
Stack Trace:
[HttpException (0x80004005): The View State is invalid for this page and
might be corrupted.]
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +150
System.Web.UI.Page.LoadPageViewState() +16
System.Web.UI.Page.ProcessRequestMain() +421

And My Code is in ".js" file:
function save()

{

document.forms(0).method = "post";

document.forms(0).action = "formsave1.aspx";

document.forms(0).submit();

}

Please let me know wat can be the reason.

Thanks in advance..

cheers !!

Nov 18 '05 #3

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

Similar topics

18
by: Lorem Ipsum | last post by:
interesting! I just found a page in which Explorer's View Source does nothing! How did they do that?
6
by: TS | last post by:
Hi, i have a problem validating xml against schema. I used http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx validator and it says it is fine. Can you tell me why this doesn't work? ...
1
by: John Hunter | last post by:
I've recently had a nasty problem with the "Invalid reference to the property Form" error in subforms - nasty because it doesn't seem to consistently happen to all forms which contain the same...
7
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm...
2
by: GD | last post by:
Hi, An intranet application, with a SMTP mail function that lets users to attach files with emails by selecting files in their local computers (through a file browser component), works perfect on...
2
by: matsla | last post by:
Hi, I use the ICallbackEventHandler interface, as per "Implementing Client Callbacks Without Postbacks in ASP.NET Web Pages". When i update some dropdown controlls in the callback and then do...
4
by: escristian | last post by:
Hello. I'm trying to create an Image so I use something like this: Image newImage = Image.FromFile(filename); Now when it's a bmp file and certain .gif files it gives me an exception that...
1
by: Xerxes | last post by:
Hi, I get the "Invalid return" error (in Javascript console) when I run this piece of code: <a href="javascript:if (document.dc_form.tn.value == ''' && document.dc_form.cid.value == '') {...
4
RMWChaos
by: RMWChaos | last post by:
Darnit all, I expect the code I steal from others to work! =D Below is some code that I got to initiate multiple javascripts on page load (rather than using the "onload=" attribute). According the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.