当客户端通过多个IP的每个请求连接的ViewState解码失败 [英] ViewState decoding failure when client connects via multiple IP's per request

查看:88
本文介绍了当客户端通过多个IP的每个请求连接的ViewState解码失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个半奇怪的问题,为我们的网站。

We have a semi-weird issue for our site.

始终如一,从1匿名用户*出现以下错误:

Consistently, from 1 anonymous* user the following error occurs:

异常类型信息:System.FormatException

Exception type: System.FormatException

异常消息:为无效的长度
  一个base-64字符数组。

Exception message: Invalid length for a Base-64 char array.

在一些调查,它出现在用户使用某种形式的负载平衡防火墙,作为IIS日志示出了从两个不同的(但连续的)IP的始发请求。

After some investigation, it appears the user is using some form of load-balancing firewall, as the IIS logs shows the requests originating from 2 different (but successive) IP's.

据我判断,禁用ViewStateMAC应该解决这个问题。

From what I can determine, disabling 'ViewStateMAC' should solve this issue.

我不肯定然而,没有任何方式与用户进行测试,我觉得有点不情愿与不前。

I am not however sure, and without any way to test this with the user, I feel a bit reluctant to go ahead with that.

有没有人遇到过类似的问题?你怎么处理?

Has anyone experienced similar issues? How did you deal with them?

服务器的详细信息:

单台服务器(Win2003的)从一个单一的IP上运行。

Single server (Win2003) running from a single IP.

更新:

据我判断,ViewStateMAC仅用于服务器端。我的问题是由于客户端回发多个IP的单页。

From what I can determine, ViewStateMAC is only for the server-side. My issue is due to a client posting back a single page with multiple IP's.

*但是,从同一两个IP作为从IIS日志决心。用户还没有恶意。

* But from the same 2 IP's as determined from IIS logs. The user is also not malicious.

推荐答案

嘿 - 我们上的应用程序看到这些错误的一个不寻常的金额 - 由于客户要求和缺乏对这些指导 - 使用过量并在每一页上特别GridView的对照

Hey - we're seeing an unusual amount of these errors on an application that - due to client requirement and lack of guidance on these - use an excessive amount of controls and in particular GridViews on each page.

最明显的罪魁祸首是视图状态在某些极端的情况下是+ 50K长字的长度。由于这是只用一组有限的用户管理应用程序,我们初步解决了这个完全使用这个优秀的(你有点过时)文章中概述的解决方案的改编版视图状态迁入会话:
http://msdn.microsoft.com/en-us/magazine/cc163577.aspx
然而,这给了我们的问题与使用后退按钮和/或标签式浏览的人。

The obvious culprit was the length of the viewstate which in some extreme cases was +50k characters long. As this is an administrative application only used by a limited set of users we initially solved this completely by moving the viewstate into session using an adapted version of the solution outlined in this excellent (thou slightly dated) article: http://msdn.microsoft.com/en-us/magazine/cc163577.aspx However this gave us issues with people using the back button and/or tabbed browsing.

接下来,我们再增加了一些额外的记录code - 和证实问题确实正是错误说 - 基64 CS codeD字符串必须由4的长度是可分的 - 当我们得到这个错误,这是从来没有的情况。
他们认为,有些代理服务器和/或防火墙我们只是斩去在某些时候ViewState的字符串。
然后,我们使用ASP.NET的ViewStateChunking超过几个隐藏字段的字段分裂 - 我们还在监视该解决方案

Next we then added some extra logging code - and confirmed that the issue was indeed just what the error said - base-64 encoded strings must have a length that is dividable by 4 - and when we got this error that was never the case. The assumption was that some proxies and/or firewalls we're simply chopping off the viewstate string at some point. We then used ASP.NET's ViewStateChunking to split the field over several hidden fields - we're still monitoring this solution.

不过 - 我最近买了一个视图状态字段有一个有效的长度错误 - 但是__EVENTVALIDATION字段长度是在这个无效

However - I recently got the error on a viewstate field that had a valid length - however the __EVENTVALIDATION field length was invalid on this.

在哪里发生这种情况,我们有一个在他们+标志字段(电话codeS)的页面 - 我目前正在研究,如果这一切由原始字符串无效编码可能引起的(如+迹象在基64 endoded串)具有特殊意义。

On the page where this happened we have fields that have "+" signs in them (telephone codes) - I am currently looking into if all this is perhaps caused by invalid encoding of the original strings (as + signs have a special meaning in base-64 endoded strings).

这篇关于当客户端通过多个IP的每个请求连接的ViewState解码失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆