YAFLogo

bobwith5
  • bobwith5
  • 52.4% (Neutral)
  • YAF Forumling Topic Starter
7 years ago
When ever I'm trying to post any new topic Im getting the below error. Can you please tell me how to resolve this issue.

____________________________________________________________________________

Server Error in '/' Application.

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that 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 configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Source Error:

[No relevant source lines]

Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\5ab8abfc\b17f62e8\App_Web_ylvox2ra.4.cs Line: 0

Stack Trace:

[ViewStateException: Invalid viewstate.

[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]

System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +198

System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +432

System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Deserialize(String serializedState, Purpose purpose) +8

System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) +40

System.Web.UI.HiddenFieldPageStatePersister.Load() +248

System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +88

System.Web.UI.Page.LoadAllState() +36

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6704

System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245

System.Web.UI.Page.ProcessRequest() +72

System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21

System.Web.UI.Page.ProcessRequest(HttpContext context) +58

ASP.forum_forum_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\5ab8abfc\b17f62e8\App_Web_ylvox2ra.4.cs:0

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 3.0.3
7 years ago
Which YAF Version? Did you have a machine key in your web.config as the error message suggests?
bobwith5
  • bobwith5
  • 52.4% (Neutral)
  • YAF Forumling Topic Starter
7 years ago
My YAF Version is YAF 2.0.0

This is my web.config file

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<configSections>
		<section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" requirePermission="false" />
	</configSections>
	<connectionStrings configSource="db.config" />
	<appSettings configSource="app.config" />
	<rewriter configSource="URLRewriter.config" />
	<system.net>
		<mailSettings>
			<smtp configSource="mail.config" />
		</mailSettings>
	</system.net>
	<system.web>
		<httpRuntime requestValidationMode="2.0" />
		<xhtmlConformance mode="Strict" />
		<customErrors defaultRedirect="~/forum/Error.aspx" mode="Off" />
		<!--  GLOBALIZATION
    This section sets the globalization settings of the application. 
    Utf-8 is not supported on Netscape 4.x 
    If you need netscape compatiblity leave iso-8859-1.
    UTF-8 is recommended for complex languages
    -->
		<globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />
		<!--<globalization culture="en-US" uiCulture="en"  fileEncoding="iso-8859-1" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1"/>-->
		<authentication mode="Forms">
			<forms name=".YAFNET_Authentication" protection="All" timeout="43200" cookieless="UseCookies" />
		</authentication>
		<!-- Set debug to "true" to test out the system in development -->
		<compilation debug="true" targetFramework="4.0">
			<assemblies>
				<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral />
				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral /></assemblies>
		</compilation>
		<httpHandlers>
			<add verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
		</httpHandlers>
		<httpModules>
			<add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" />
			<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" />
		</httpModules>
		<pages enableEventValidation="false" validateRequest="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
			<controls>
				<!-- Default: use non-dynamic (compiled classes) in YAF -->
				<add tagPrefix="YAF" namespace="YAF.Controls" assembly="YAF.Controls" />
				<add tagPrefix="YAF" namespace="YAF.Controls.Statistics" assembly="YAF.Controls" />
				<add tagPrefix="YAF" namespace="YAF.Classes" />
				<add tagPrefix="YAF" namespace="YAF" />
			</controls>
			<namespaces>
				<add namespace="YAF.Core" />
				<add namespace="YAF.Controls" />
				<add namespace="YAF.Utils" />
				<add namespace="YAF.Types.Interfaces" />
				<add namespace="YAF.Types" />
			</namespaces>
		</pages>
		<roleManager enabled="true" defaultProvider="YafRoleProvider">
			<providers>
				<clear />
				<add connectionStringName="yafnet" applicationName="YetAnotherForum" name="YafRoleProvider" type="YAF.Providers.Roles.YafRoleProvider" />
			</providers>
		</roleManager>
		<membership defaultProvider="YafMembershipProvider" hashAlgorithmType="SHA1">
			<providers>
				<clear />
				<add connectionStringName="yafnet" applicationName="YetAnotherForum" name="YafMembershipProvider" requiresUniqueEmail="true" useSalt="true" type="YAF.Providers.Membership.YafMembershipProvider" />
			</providers>
		</membership>
		<profile enabled="true" defaultProvider="YafProfileProvider" inherits="YAF.Utils.YafUserProfile">
			<providers>
				<clear />
				<add connectionStringName="yafnet" applicationName="YetAnotherForum" name="YafProfileProvider" type="YAF.Providers.Profile.YafProfileProvider" />
			</providers>
		</profile>
	</system.web>
	<system.webServer>
		<validation validateIntegratedModeConfiguration="false" />
		<modules>
			<remove name="YafTaskModule" />
			<remove name="UrlRewriter" />
			<add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" preCondition="managedHandler" />
			<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" preCondition="managedHandler" />
		</modules>
		<handlers>
			<add name="YafHandler" preCondition="integratedMode" verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
		</handlers>
        <directoryBrowse enabled="false" />
        <defaultDocument>
            <files>
                <clear />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
                <add value="index.php" />
            </files>
        </defaultDocument>
	</system.webServer>
</configuration>
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 3.0.3
7 years ago
You need to add a machine key to your web.config, you can do that by generating one here

http://aspnetresources.com/tools/machineKey 

and place it after the

<system.web>


<system.web>
    <machineKey 
        validationKey="....." 
        decryptionKey="....." 
    />
    
bobwith5
  • bobwith5
  • 52.4% (Neutral)
  • YAF Forumling Topic Starter
7 years ago
Thank you so much.It resolved my issue