PDA

View Full Version : سوال: این ارور مربوط به چیه ؟



vaheeed
چهارشنبه 29 آذر 1391, 11:28 صبح
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:


[ViewStateException: Invalid viewstate.
Client IP: 5.52.220.156
Port: 35939
Referer: http://nooshinco.com/Catalog.aspx
Path: /Catalog.aspx
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
ViewState: /wEPDwUJNjAxODc0OTcyZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVB vc3RCYWNrS2V5X18WCAUNSW1hZ2VCdXR0b24xNQUNSW1hZ2VCd XR0b24xNgUNSW1hZ2VCdXR0b24xNwUNSW1hZ2VCdXR0b24xMAU NSW1hZ2VCdXR0b24xMgUNSW1hZ2VCdXR0b24xMQUNSW1hZ2VCd XR0b24xMwUNSW1hZ2VCdXR0b24xNDA9KSUF/9POZRIFQHN2DkCNWWXRn6TnYjs5CUzaOric]

[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.ViewStateException.ThrowError(Except ion inner, String persistedState, String errorPageMessage, Boolean macValidationError) +235
System.Web.UI.ViewStateException.ThrowMacValidatio nError(Exception inner, String persistedState) +14
System.Web.UI.ObjectStateFormatter.Deserialize(Str ing inputString) +274
System.Web.UI.ObjectStateFormatter.System.Web.UI.I StateFormatter.Deserialize(String serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFor matter formatter, String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +241
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +106
System.Web.UI.Page.LoadAllState() +43
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8431
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +253
System.Web.UI.Page.ProcessRequest() +78
System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.catalog_aspx.ProcessRequest(HttpContext context) in c:\windows\Microsoft.NET\Framework\v4.0.30319\Temp orary ASP.NET Files\root\5ac896d1\cdb8abe3\App_Web_s3ecucih.1.cs :0
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +75

vaheeed
چهارشنبه 29 آذر 1391, 11:29 صبح
درست کار میکنه به خورده که میگذره یه دفعه این اررور رو میده اگه الان سایت رو باز کنید مشکلی نداره بعضی وقتا این اررور رو میده نمیدونم چرا ؟؟!!!!

alihassanabadi
چهارشنبه 29 آذر 1391, 14:15 عصر
سلام
EnableViewStateMAC رو یادر سطح پیج False کن یا در سطح application
موفق باشید.

vaheeed
چهارشنبه 29 آذر 1391, 14:37 عصر
میشه بیشتر راهنمایی کنی ؟؟ از کجا فالس کنم ؟ و اگه حوصله داری کلا چرا و چجوری این اتفاق میوفته ؟؟
ممنون

alihassanabadi
چهارشنبه 29 آذر 1391, 14:51 عصر
در سطح پیج
تو قسمت Design صفحه

<%@ Page Language="C#" AutoEventWireup="true" EnableViewStateMac="false" CodeFile="Default.aspx.cs" Inherits="_Default" %>
و یا توی فایل Web.config برای کل پیج ها


<system.web>
<pages enableViewStateMac="false"></pages>
</system.web>

برای امنیت ViewState کاربرد داره سر حد کلمات جمله زیر می باشد message authentication codes
توضیحات بیشتر در msdn
http://msdn.microsoft.com/en-us/library/system.web.ui.page.enableviewstatemac.aspx
و خیلی بیشتر و بهتر
http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx
موفق باشید.