lankapala
asked on
ASP.net C# formas
i wrote in C# Form. i need to pass data to another form iam getting error .
My code is
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" action="Test.aspx" >
<div>
</div>
<input id="Submit1" type="submit" value="submit" />
</form>
</body>
</html>
please find below the error
Server Error in '/ASP.net Examples1' Application.
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
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: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.M achineKeyS ection.Get DecodedDat a(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +289
System.Web.UI.ObjectStateF ormatter.D eserialize (String inputString) +140
[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.11) Gecko/20100701 AskTbBT5/3.8.0.12304 Firefox/3.5.11 (.NET CLR 3.5.30729)
ViewState: /wEPDwUJNzgzNDMwNTMzZGTTCB 5T1owA+CoK GPa6sqSSQj U75w==
Referer: http://localhost:50604/ASP.net%20Examples1/Default.aspx
Path: /ASP.net Examples1/Test.aspx]
[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
System.Web.UI.ViewStateExc eption.Thr owError(Ex ception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
System.Web.UI.ViewStateExc eption.Thr owMacValid ationError (Exception inner, String persistedState) +14
System.Web.UI.ObjectStateF ormatter.D eserialize (String inputString) +242
System.Web.UI.ObjectStateF ormatter.S ystem.Web. UI.IStateF ormatter.D eserialize (String serializedState) +4
System.Web.UI.Util.Deseria lizeWithAs sert(IStat eFormatter formatter, String serializedState) +37
System.Web.UI.HiddenFieldP ageStatePe rsister.Lo ad() +207
System.Web.UI.Page.LoadPag eStateFrom Persistenc eMedium() +105
System.Web.UI.Page.LoadAll State() +43
System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt) +6785
System.Web.UI.Page.Process Request(Bo olean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt) +242
System.Web.UI.Page.Process Request() +80
System.Web.UI.Page.Process RequestWit hNoAssert( HttpContex t context) +21
System.Web.UI.Page.Process Request(Ht tpContext context) +49
ASP.test_aspx.ProcessReque st(HttpCon text context) +4
System.Web.CallHandlerExec utionStep. System.Web .HttpAppli cation.IEx ecutionSte p.Execute( ) +181
System.Web.HttpApplication .ExecuteSt ep(IExecut ionStep step, Boolean& completedSynchronously) +75
My code is
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" action="Test.aspx" >
<div>
</div>
<input id="Submit1" type="submit" value="submit" />
</form>
</body>
</html>
please find below the error
Server Error in '/ASP.net Examples1' Application.
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
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: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.M
System.Web.UI.ObjectStateF
[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.11) Gecko/20100701 AskTbBT5/3.8.0.12304 Firefox/3.5.11 (.NET CLR 3.5.30729)
ViewState: /wEPDwUJNzgzNDMwNTMzZGTTCB
Referer: http://localhost:50604/ASP.net%20Examples1/Default.aspx
Path: /ASP.net Examples1/Test.aspx]
[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
System.Web.UI.ViewStateExc
System.Web.UI.ViewStateExc
System.Web.UI.ObjectStateF
System.Web.UI.ObjectStateF
System.Web.UI.Util.Deseria
System.Web.UI.HiddenFieldP
System.Web.UI.Page.LoadPag
System.Web.UI.Page.LoadAll
System.Web.UI.Page.Process
System.Web.UI.Page.Process
System.Web.UI.Page.Process
System.Web.UI.Page.Process
System.Web.UI.Page.Process
ASP.test_aspx.ProcessReque
System.Web.CallHandlerExec
System.Web.HttpApplication
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Of course it's sent. Use:
Response.Write(Request.Form["TxtValue"]);
ASKER
Great Excellent Answer. Good job.
ASKER
Excellent Great Job
ASKER
i wrote code like this
<%
Response.Write(Request.For
%>
But its not working in next page