__VIEWSTATE 包含什么?

发布于 2024-08-03 05:32:25 字数 655 浏览 3 评论 0原文

我很抱歉可能会提出这样一个基本问题,但是在 ASP.NET 网站中 __VIEWSTATE 输入字段代表什么?

另外,有什么方法可以计算它的值(基于其他表单字段的值)?

编辑

我知道 __VIEWSTATE ,顾名思义,维护网页中表单字段值的值,但是我有兴趣知道的是如何生成此状态(字符串)。如果我对任何 __VIEWSTATE 字符串进行 base64_decode,我看到的只是一堆神秘的 HTML。

有什么方法可以更好地理解正在编码的内容吗?我搜索了过去的问题,找到了一些可以执行此操作的工具 喜欢这个,但不幸的是它似乎不起作用。

我问这个问题的原因是因为我可以访问 Web 服务 API,它为我提供了我需要使用的大部分值。但是,我还需要一个仅在表单最后阶段可用的附加字段。我已经联系了网络服务提供商,但不幸的是他们不会这么快更新他们的 API。我希望我可以使用 Web 服务数据预填充表单初始值,然后计算 __VIEWSTATE 以访问表单最后阶段显示的最后一个字段,这将使整个过程更快。

不确定我是否说得足够清楚......

I'm sorry for maybe making such a basic question but in ASP.NET websites what does the __VIEWSTATE input field represent?

Also, is there any way to compute it's value (based on the values of other form fields)?

EDIT

I understand that __VIEWSTATE, as the name suggests, maintains the values of form field values in webpages however what I'm interested in knowing is how this state (the string) is generated. If I base64_decode any __VIEWSTATE string all I see is a bunch of cryptic HTML.

Is there any way to better understand what exactly is being encoded? I've searched on past questions and I've found some tools that can do this like this one, but unfortunately it doesn't seem to work.

The reason I'm asking this is because I've access to a web service API that gives me most of the values I need to work with. However I also need an additional field that is only available on the last stage of the form. I already contacted the web service provider but unfortunately and they're not going to update their API so soon. I was hoping I could prefill the form initial values using the web service data and then calculate the __VIEWSTATE to access the last field that shows up on the last stage of the form, it would make the whole process a lot faster.

Not sure if I made myself clear enough though...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

木有鱼丸 2024-08-10 05:32:25

Paul Wilson 有一篇非常好的文章:ViewState:您想知道的一切

VIEWSTATE可以使用 LosFormatter 类进行反序列化。

Paul Wilson has a very good article: ViewState: All You Wanted to Know

VIEWSTATE can be deserialized with the LosFormatter class.

手心的温暖 2024-08-10 05:32:25

快速的 Google 搜索回答了这个问题:

http://msdn.microsoft.com/ en-us/library/ms972976.aspx

第一句:

Microsoft® ASP.NET 视图状态,在
简而言之,是使用的技术
保存更改的 ASP.NET 网页
Web 表单的状态
回发。

A quick Google search answers the question:

http://msdn.microsoft.com/en-us/library/ms972976.aspx

First sentence:

Microsoft® ASP.NET view state, in a
nutshell, is the technique used by an
ASP.NET Web page to persist changes to
the state of a Web Form across
postbacks.

薆情海 2024-08-10 05:32:25

如果您确实想很好地理解它,请参阅 Dave Reed 关于 ViewState 的文章

If you really want to understand it well, see Dave Reed's article about ViewState.

殤城〤 2024-08-10 05:32:25

请查看 http://forums.techarena.in/ 上发布的 biter 脚本windows-software/1329157.htm

该脚本展示了如何设置和使用 __ViewState 和其他 .NET 变量。

该脚本登录到 .NET 站点并获取股票价值,而无需通过浏览器。该脚本不是用户手动执行,而是以编程方式执行。

Do take a look at the biter script posted at http://forums.techarena.in/windows-software/1329157.htm.

That script shows how to set up and use __ViewState and other .NET variables.

That script logs into a .NET site, and gets stock values, without going thru a browser. Instead of user doing it manually, the script does it programmatically.

风流物 2024-08-10 05:32:25

计算它的值是什么意思?

假设它是文本形式的表单字段/值的压缩(实际上是 Base64 编码)对,它被序列化为服务器端对象供您使用。

What do you mean by compute it's value?

Assume that it is a compressed (actually Base64 encoded) pair of your form fields/values in text form, which gets serialized into server side objects for you to work with.

绅士风度i 2024-08-10 05:32:25

在 Razor 中执行此操作的最简单方法是将其放在视图上:

@{
    throw new Exception();
} 

The easiest way of doing this in Razor is putting this on a view:

@{
    throw new Exception();
} 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文