gpt4 book ai didi

asp.net - System.Web.UI.ViewStateException ,无效的 View 状态

转载 作者:行者123 更新时间:2023-12-04 20:46:49 24 4
gpt4 key购买 nike

我的网站每天都在抛出以下异常,我找不到解决方案。
我在网络上做了很少的研究,这就是我目前所做的。将以下选项添加到 aspx 不会解决问题。

ValidateRequest="false" EnableEventValidation="false" ViewStateEncryptionMode="Never" EnableViewStateMac="false"



此外,我的推荐 URL 是正确的 URL,我不知道它如何使用两个(相同)参数重定向。我的推荐页面中没有这样的链接。请帮忙。

错误日志
URL : http://www.abcd.com/company-details.aspx?com=asia-pacific-pte-ltd&com=asia-pacific-pte-ltd

referral URL : http://www.abcd.com/companies/asia-pacific-pte-ltd/

Inner Exception Type: System.Web.UI.ViewStateException

Inner Exception: Invalid viewstate. Client IP: 192.162.19.193 Port: 1966 User-Agent: Opera/9.80 (Windows NT 6.1; WOW64; MRA 6.0 (build 6001)) Presto/2.12.388 Version/12.11 ViewState: /wEPDwULLTEyMTAyMTY3NDAPZBYCAgMPZBYOZg8QDxYGHg1EYXRhVGV4dEZpZWxkBQdDb3VudHJ5Hg5EYXRhVmFsdWVGaWVsZAUNQ2xlYW5fQ291bnRyeR4LXyFEYXRhQm91bmRnZBAVCgNBbGwFQ2hpbmEJSG9uZyBLb25nBUluZGlhCUluZG9uZXNpYQhNYWxheXNpYQtQaGlsaXBwaW5lcwlTaW5nYXBvcmUIVGhhaWxhbmQHVmlldG5hbRUKA0FsbAVjaGluYQlob25nLWtvbmcFaW5kaWEJaW5kb25lc2lhCG1hbGF5c2lhC3BoaWxpcHBpbmVzCXNpbmdhcG9yZQh0aGFpbGFuZAd2aWV0bmFtFCsDCmdnZ2dnZ2dnZ2dkZAIBDxAPFgYfAAUISW5kdXN0cnkfAQUOQ2xlYW5fSW5kdXN0cnkfAmdkEBXFAgNBbGwSQWR2YW5jZWQgTWF0ZXJpYWxzC0FkdmVydGlzaW5nCkFlc3RoZXRpY3MLQWdyaWN1bHR1cmUkQWdyaWN1bHR1cmUgLSBBZ3JpY3VsdHVyYWwgTWFjaGluZXJ5G0FncmljdWx0dXJlICYgRm9vZCBQcm9kdWN0cxBBaXItY29uZGl0aW9uaW5nHUFpci1maWx0cmF0aW9uICYgUHVyaWZpY2F0aW9uB0FpcnBvcnQJQWx1bWluaXVtFEFuYWx5dGljYWwgRXF1aXBtZW50GkFuYWx5dGljYWwgSW5zdHJ1bWVudGF0aW9uFUFuYWx5dGljYWwgVGVjaG5vbG9neRZBbmQgSW50ZXJpb3IgRGVzaWduZXJzEUFuaW1hbCBQcm9kdWN0aW9uCEFudGlib2R5KUFwc...

Inner Source:

Exception Type: System.Web.HttpException

Exception: The state information is invalid for this page and might be corrupted.

Stack Trace: at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) at System.Web.UI.HiddenFieldPageStatePersister.Load() at System.Web.UI.Page.LoadPageStateFromPersistenceMedium() at System.Web.UI.Page.LoadAllState() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.exhibition_details_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\0f461847\442b0502\App_Web_bfjqxdef.20.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

更新
我通过从下面的链接压缩 ViewState 修复了错误
http://www.codeproject.com/Articles/14733/ViewState-Compression

并通过用此替换原始方法来修复 Base-64 字符数组错误的无效长度。
protected override object LoadPageStateFromPersistenceMedium()
{
string viewState = Request.Form["__VSTATE"];
viewState = viewState.Replace(" ", "+");

int mod4 = viewState.Length % 4;
if (mod4 > 0)
{
viewState += new string('=', 4 - mod4);
}
byte[] bytes = Convert.FromBase64String(viewState);
bytes = Compressor.Decompress(bytes);
LosFormatter formatter = new LosFormatter();
return formatter.Deserialize(Convert.ToBase64String(bytes));
}

谢谢大家的帮助:)

最佳答案

我很抱歉这么说但是您的网站没有任何内容 ,并且您需要尽快重新启用您的 EventValidations。

你看到的是an attempt to hack your site通过发送许多测试 numbers with your ViewState trying to find your hash key .

IP you give have a big list of activity the last few days .

现在,可能导致此错误的替代方法是破坏 ViewState。您可以 compress it and split it如果你有太大的 ViewState。您也可以disable all the controls that not needed .您也可以添加 log to see from inside what's is going on right on a base page .

关于asp.net - System.Web.UI.ViewStateException ,无效的 View 状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16395715/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com