Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > "View State Invalid" Error While Submitting Form thru JavaScript

Reply
Thread Tools

"View State Invalid" Error While Submitting Form thru JavaScript

 
 
Vinod I
Guest
Posts: n/a
 
      02-16-2004
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 !!


 
Reply With Quote
 
 
 
 
matt
Guest
Posts: n/a
 
      02-16-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 !!
>
>



 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      03-02-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 !!
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form within a Form - will it cause problems when submitting? Dave Smithz HTML 3 10-30-2009 07:24 AM
Order notes starting at C thru B rather than A thru G Max Williams Ruby 3 01-06-2009 11:37 AM
RDP thru Cisco VPN client and thru 501 Failure curttampa@gmail.com Cisco 21 08-26-2008 03:11 PM
Can't access Web Service thru DLL (but can thru Windows App) THTB ASP .Net Web Services 0 05-17-2007 06:43 PM
Problem while submitting FORM data Karuna Javascript 2 08-06-2004 01:33 PM



Advertisments