943,948 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 1332
  • C# RSS
Jan 2nd, 2009
0

Simple <Form> data error

Expand Post »
Hello all,
I am trying to pass data between two files using POST method.
I am using Visual Studio 2008 and working in C# Environment to run this in ASP.net.

The code i am using is:
sareeweb.aspx

c# Syntax (Toggle Plain Text)
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="sareeweb.aspx.cs" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7. <title>Untitled Page</title>
  8. </head>
  9. <body>
  10. <form id="form1" action="logink.aspx" method="post" runat="server">
  11. <div>
  12.  
  13. Name <input type="text" name="Name"/>
  14. Age <input type="text" name="Age"/>
  15. <input type="submit" />
  16.  
  17. </div>
  18. </form>
  19. </body>
  20. </html>

logink.aspx

C# Syntax (Toggle Plain Text)
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="logink.aspx.cs" Inherits="logink" debug="true"%>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7. <title>Untitled Page</title>
  8. </head>
  9. <body>
  10. <form id="form1" runat="server">
  11. <div>
  12. <%
  13. string name, age;
  14.  
  15. name = Request.Form["Name"];
  16. age = Request.Form["Age"];
  17. Response.Write(name);
  18. Response.Write(age);
  19. %>
  20.  
  21.  
  22. </div>
  23. </form>
  24. </body>
  25. </html>

This is all what i am using and i keep getting errors on logink.aspx

Errors:
Server Error in '/sareeweb' 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:

[No relevant source lines]


Can some one please shed some light on this please

Thank you.
Similar Threads
Reputation Points: 11
Solved Threads: 3
Junior Poster in Training
csharplearner is offline Offline
99 posts
since Nov 2008
Jan 2nd, 2009
1

Re: Simple <Form> data error

Sounds like a config error. Whats in your config file?
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Jan 2nd, 2009
0

Re: Simple <Form> data error

Click to Expand / Collapse  Quote originally posted by LizR ...
Sounds like a config error. Whats in your config file?
There is soo much stuff in the config file..

i included the one in line 31 under system.web
C# Syntax (Toggle Plain Text)
  1. <?xml version="1.0"?>
  2. <!--
  3. Note: As an alternative to hand editing this file you can use the
  4. web admin tool to configure settings for your application. Use
  5. the Website->Asp.Net Configuration option in Visual Studio.
  6. A full list of settings and comments can be found in
  7. machine.config.comments usually located in
  8. \Windows\Microsoft.Net\Framework\v2.x\Config
  9. -->
  10. <configuration>
  11.  
  12.  
  13. <configSections>
  14. <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  15. <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  16. <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
  17. <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  18. <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
  19. <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
  20. <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
  21. <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
  22. </sectionGroup>
  23. </sectionGroup>
  24. </sectionGroup>
  25. </configSections>
  26.  
  27.  
  28. <appSettings/>
  29. <connectionStrings/>
  30. <system.web>
  31. [U][I]<trace enabled="true" pageOutput="false" requestLimit="9" traceMode="SortByCategory"/>[/I][/U]
  32.  
  33.  
  34.  
  35.  
  36. <!--
  37. Set compilation debug="true" to insert debugging
  38. symbols into the compiled page. Because this
  39. affects performance, set this value to true only
  40. during development.
  41. -->
  42. <compilation debug="true">
  43.  
  44. <assemblies>
  45. <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  46. <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  47. <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  48. <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  49. </assemblies>
  50.  
  51. </compilation>
  52. <!--
  53. The <authentication> section enables configuration
  54. of the security authentication mode used by
  55. ASP.NET to identify an incoming user.
  56. -->
  57. <authentication mode="Windows" />
  58. <!--
  59. The <customErrors> section enables configuration
  60. of what to do if/when an unhandled error occurs
  61. during the execution of a request. Specifically,
  62. it enables developers to configure html error pages
  63. to be displayed in place of a error stack trace.
  64.  
  65. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
  66. <error statusCode="403" redirect="NoAccess.htm" />
  67. <error statusCode="404" redirect="FileNotFound.htm" />
  68. </customErrors>
  69. -->
  70.  
  71.  
  72. <pages>
  73. <controls>
  74. <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  75. <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  76. </controls>
  77. </pages>
  78.  
  79. <httpHandlers>
  80. <remove verb="*" path="*.asmx"/>
  81. <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  82. <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  83. <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
  84. </httpHandlers>
  85. <httpModules>
  86. <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  87. </httpModules>
  88.  
  89.  
  90. </system.web>
  91.  
  92. <system.codedom>
  93. <compilers>
  94. <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
  95. type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
  96. <providerOption name="CompilerVersion" value="v3.5"/>
  97. <providerOption name="WarnAsError" value="false"/>
  98. </compiler>
  99. <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
  100. type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
  101. <providerOption name="CompilerVersion" value="v3.5"/>
  102. <providerOption name="OptionInfer" value="true"/>
  103. <providerOption name="WarnAsError" value="false"/>
  104. </compiler>
  105. </compilers>
  106. </system.codedom>
  107.  
  108. <!--
  109. The system.webServer section is required for running ASP.NET AJAX under Internet
  110. Information Services 7.0. It is not necessary for previous version of IIS.
  111. -->
  112. <system.webServer>
  113. <validation validateIntegratedModeConfiguration="false"/>
  114. <modules>
  115. <remove name="ScriptModule" />
  116. <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  117. </modules>
  118. <handlers>
  119. <remove name="WebServiceHandlerFactory-Integrated"/>
  120. <remove name="ScriptHandlerFactory" />
  121. <remove name="ScriptHandlerFactoryAppServices" />
  122. <remove name="ScriptResource" />
  123. <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
  124. type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  125. <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
  126. type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  127. <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  128. </handlers>
  129. </system.webServer>
  130.  
  131. <runtime>
  132. <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  133. <dependentAssembly>
  134. <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
  135. <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
  136. </dependentAssembly>
  137. <dependentAssembly>
  138. <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
  139. <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
  140. </dependentAssembly>
  141. </assemblyBinding>
  142. </runtime>
  143.  
  144.  
  145. </configuration>
Last edited by csharplearner; Jan 2nd, 2009 at 9:41 pm.
Reputation Points: 11
Solved Threads: 3
Junior Poster in Training
csharplearner is offline Offline
99 posts
since Nov 2008
Jan 2nd, 2009
1

Re: Simple <Form> data error

It's a problem with the way ViewState is configured on the machine. Have a look at this: http://www.codinghorror.com/blog/archives/000132.html
Reputation Points: 31
Solved Threads: 7
Light Poster
iDeveloper is offline Offline
49 posts
since Jul 2008
Jan 3rd, 2009
0

Re: Simple <Form> data error

Click to Expand / Collapse  Quote originally posted by iDeveloper ...
It's a problem with the way ViewState is configured on the machine. Have a look at this: http://www.codinghorror.com/blog/archives/000132.html
Thanks a bunch iDeveloper..
Not only it solved my problem but also the website u referred seems to be very useful.
Reputation Points: 11
Solved Threads: 3
Junior Poster in Training
csharplearner is offline Offline
99 posts
since Nov 2008
Jan 3rd, 2009
0

Re: Simple <Form> data error

Codding Horror is by far the most interesting blog for software developers Full of good info indeed.
Reputation Points: 31
Solved Threads: 7
Light Poster
iDeveloper is offline Offline
49 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: StringFormat
Next Thread in C# Forum Timeline: Need advice on matrix input





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC