在asp.net中解密viewstate [英] decrypt the viewstate in the asp.net

查看:354
本文介绍了在asp.net中解密viewstate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何解密asp.net中的视图状态?

asp.net采访问题

how can we decrypt the view state in asp.net ?

asp.net interview question

推荐答案

看看此链接..
http://stackoverflow.com/questions/2638671/is- it-possible-to-decrypt-and-view-viewstate-values [
Have a look on this link..
http://stackoverflow.com/questions/2638671/is-it-possible-to-decrypt-and-view-viewstate-values[^]


I like this view state decoder. Very easy to use.

http://ignatu.co.uk/ViewStateDecoder.aspx


问题非常棘手.
在详细介绍之前,首先需要知道什么是视图状态.
简而言之,ViewState是Base64编码的字符串,人眼无法读取.虽然不难解码,但可以读取视图状态信息.

在浏览器中打开任何页面,转到源页面,在剪贴板中复制视图状态值.

现在创建一个页面并添加一个hiddencontrol,

The question is very tricky.
Before I go into details, first need to know what is view state.
In brief, ViewState is a Base64 encoded string and is not readable by the human eye. Though it is not difficult to decode is and read the view state information.

Open any page in a browser, go to the source page, copy the view state value in the clipboard.

Now create a page and add a hiddencontrol,

<asp:textbox id="txt_viewstate" value="{paste from clipboard}" runat="server" xmlns:asp="#unknown"></asp:textbox>



现在添加一个按钮控件并编写按钮事件



Now add a button control and write the button event

//code behind    
protected void Button1_Click(object sender, EventArgs e)
    {
        byte[] decode = Convert.FromBase64String(txt_viewstate.Text);
        Response.Write(System.Text.Encoding.ASCII.GetString(decode));
    }



希望这会有所帮助.
欢呼



Hope this helps.
cheers


这篇关于在asp.net中解密viewstate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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