aspx中的__EVENTVALIDATION __VIEWSTATE的用途是什么? [英] What is the purpose of __EVENTVALIDATION __VIEWSTATE in aspx?

查看:42
本文介绍了aspx中的__EVENTVALIDATION __VIEWSTATE的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑:

Content-Disposition: form-data; name="__VIEWSTATE"

/wEPDwUKMTQxNzIxMTc0MQ9kFgICAw8WAh4HZW5jdHlwZQUTbXVsdGlwYXJ0L2Zvcm0tZGF0YWRkflsROmXoLo8ar8ukWWYDh1Wr2BCwmhiAAqpX/xwqLq8=

Content-Disposition: form-data; name="__EVENTVALIDATION"

/wEWBgKJ1KD6AwKH3P+GBQLr/4HeAgKWoZqyCQLinqurDALt3oXMA0YLgb/Mt6KGihl+8ixYoY9A24wgHGGoPAINhuyP7nEl

我们建立了一个用户可以在其中上传照片的网站.后来我们决定用户也可以通过其他应用程序上传照片,并且我们希望拥有统一的界面.因此,其他应用程序可以在同一页面上使用.

We make a site where users can upload photos. Later we decided that users can also upload photos via other applications, and we like to have a uniform interface. So the other applications work with the same page.

我们注意到,除非知道__EVENTVALIDATION和__VIEWSTATE的值,否则我们无法上传照片.

We notice that we cannot upload photos unless we know the value of __EVENTVALIDATION and __VIEWSTATE.

当然,应用程序只能加载上传的图像,但这有点麻烦.

Of course, the application can just load the uploading image, but that's kind of a hassle.

反正这些是什么?有没有一种方法可以在不指定内容的情况下将图像上传到aspx上传网站?

What are those for anyway? Is there a way to upload images to aspx upload web without specifying things?

推荐答案

HTTP 是一个无状态协议,这意味着客户端和服务器没有建立从一个请求到另一个请求的跟踪应用程序状态的内置方式.已经发明了各种技术来避免这种情况,例如cookie.ViewState和事件验证是 ASP.NET 使用的两种技术:感觉到网页.

HTTP is a stateless protocol which means the client and server have no built in way of tracking the state of the application from one request to the next. Various technologies have been invented to circumvent this such as cookies. ViewState and event validation are two techniques used by ASP.NET to give a state-full feel to a web page.

ViewState中的数据是所有控件(输入字段,复选框等)向下发送到客户端时的状态.将表单发布回服务器后,ASP.NET可以判断用户是否更改了任何字段中的任何值,并可以引发反映此情况的事件(

The data in ViewState is the state of all the controls (input fields, check boxes, etc.) when they were sent down to the client. When the form is posted back to the server, ASP.NET can tell if the user has changed any values in any of the fields and can raise events reflecting this (CheckedChanged on a checkbox for example). Without ViewState, the server wouldn't be able to tell if any fields had changed.

事件验证可确保在客户端上引发的事件源自ASP.NET呈现的控件.

Event Validation ensures that events raised on the client originate from the controls rendered by ASP.NET.

这是关于ViewState的论文涵盖事件验证的另一项内容.

这篇关于aspx中的__EVENTVALIDATION __VIEWSTATE的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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