Simple <Form> data error

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Nov 2008
Posts: 99
Reputation: csharplearner is an unknown quantity at this point 
Solved Threads: 3
csharplearner's Avatar
csharplearner csharplearner is offline Offline
Junior Poster in Training

Simple <Form> data error

 
0
  #1
Jan 2nd, 2009
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

  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

  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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Simple <Form> data error

 
1
  #2
Jan 2nd, 2009
Sounds like a config error. Whats in your config file?
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 99
Reputation: csharplearner is an unknown quantity at this point 
Solved Threads: 3
csharplearner's Avatar
csharplearner csharplearner is offline Offline
Junior Poster in Training

Re: Simple <Form> data error

 
0
  #3
Jan 2nd, 2009
Originally Posted by LizR View Post
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
  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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 49
Reputation: iDeveloper is an unknown quantity at this point 
Solved Threads: 7
iDeveloper iDeveloper is offline Offline
Light Poster

Re: Simple <Form> data error

 
1
  #4
Jan 2nd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 99
Reputation: csharplearner is an unknown quantity at this point 
Solved Threads: 3
csharplearner's Avatar
csharplearner csharplearner is offline Offline
Junior Poster in Training

Re: Simple <Form> data error

 
0
  #5
Jan 3rd, 2009
Originally Posted by iDeveloper View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 49
Reputation: iDeveloper is an unknown quantity at this point 
Solved Threads: 7
iDeveloper iDeveloper is offline Offline
Light Poster

Re: Simple <Form> data error

 
0
  #6
Jan 3rd, 2009
Codding Horror is by far the most interesting blog for software developers Full of good info indeed.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC