473,738 Members | 5,934 Online
Bytes | Software Development & Data Engineering Community
+ 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.Http Exception: 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.P age.LoadPageSta teFromPersisten ceMedium() +150
System.Web.UI.P age.LoadPageVie wState() +16
System.Web.UI.P age.ProcessRequ estMain() +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 3216
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.Rewrite path 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.co m> wrote in message
news:OB******** ******@TK2MSFTN GP12.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.Http Exception: 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.P age.LoadPageSta teFromPersisten ceMedium() +150
System.Web.UI.P age.LoadPageVie wState() +16
System.Web.UI.P age.ProcessRequ estMain() +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.co m> wrote in message
news:OB******** ******@TK2MSFTN GP12.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.Http Exception: 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.P age.LoadPageSta teFromPersisten ceMedium() +150
System.Web.UI.P age.LoadPageVie wState() +16
System.Web.UI.P age.ProcessRequ estMain() +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
2555
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
13593
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? Thanks! Schema: <?xml version="1.0"?> <xs:schema id="ReportInfo" targetNamespace="http://tempuri.org/Reports.xsd"
1
5410
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 structure and code. Judging by the forums I've researched, it's not an uncommon error. I'm happy to say I've found a simple solution. OVERVIEW: I have a main form (no record source) which contains two subforms. The subforms are not linked, but...
7
17879
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 able to encrypt and then decrypt data okay as in the following code: // encrypt the data // Encryptor enc = new Encryptor(EncryptionAlgorithm.TripleDes); byte key = Encoding.ASCII.GetBytes("0123456789012345");
2
4436
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 my local machine. However, after deployment to a server that has Windows 2003 Sever installed, the mail function is able to attach the file created by the application. However, when users attach some files selected from their local machines, it...
2
627
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 a postback i get following error => "Invalid postback or callback argument. Event validation is enabled using
4
3060
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 says: "Invalid parameter used". The gif an bmp files are valid image files, I can open them in any graphics software and windows can do the preview.
1
3621
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 == '') { alert('You have not made a selection. Please select one of the fields first.');return false; } document.dc_form.submit();">Go!</a> If I remove the "return false;", it displayes the alert and continues
4
3344
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 blog where it was posted, it seems that it works for everyone who posted replies...not a single "this is not working for me" post. The errors I receive are as follows: IE7: expected ";" and then "conditional compilation is turned off" FF &...
0
9335
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9263
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6053
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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 we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.