F
frankswildyearstom
Hello,
Q1 - If character ‘C’ is saved into viewstate, then just before the
page is rendered, Asp.Net serializes ‘C’ ( along with other data )
into Base64 string. If on postback I issue the following code:
In aspx page:
<%@ Page Language="C#" AutoEventWireup="true"
EnableViewStateMac="false".../>
In cs. file:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "ABCDEF";
if (IsPostBack)
{
string viewStateString=Request["__VIEWSTATE"];
byte[] stringBytes = Convert.FromBase64String
(viewStateString);
for (int i = 0; i < stringBytes.Length; i++)
{
if(stringBytes == 67)
Label1.Text = ”deserialization successful”;
}
}
}
, then FromBase64String() should convert serialized data back into
their original format. Thus, one of ‘stringBytes’ fields should
contain a decimal value 67( which represents ASCII character C) .But
that doesn’t seem to be the case. Any ideas what I’m doing wrong?
Q2 - Since String represents a set of Unicode characters, I assume
that in the above example when “ABCDEF” is deserialized from the
viewstate, each character in “ABCDEF” string is represented with two
elements of a ‘stringBytes’ array?
Q3 - Is forms data, thus TextBox1.Text also saved in viewstate – I’m
asking this cos I don’t see a point in saving tha data since form will
save it automatically on postbacks.Are fields that are saved by
postback form automatically not included in viewstate
A) I would assume that postback data ( thus values of <input> controls
that are automatically saved on postbacks) is not also saved into
ViewState, since there wouldn't be any point in doing that
B) If so, then for example TextBox.Text doesn't use ViewState as its
backing store?
much appreciated
EDIT:
I must apologize for not mentioning that
Q1 - If character ‘C’ is saved into viewstate, then just before the
page is rendered, Asp.Net serializes ‘C’ ( along with other data )
into Base64 string. If on postback I issue the following code:
In aspx page:
<%@ Page Language="C#" AutoEventWireup="true"
EnableViewStateMac="false".../>
In cs. file:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "ABCDEF";
if (IsPostBack)
{
string viewStateString=Request["__VIEWSTATE"];
byte[] stringBytes = Convert.FromBase64String
(viewStateString);
for (int i = 0; i < stringBytes.Length; i++)
{
if(stringBytes == 67)
Label1.Text = ”deserialization successful”;
}
}
}
, then FromBase64String() should convert serialized data back into
their original format. Thus, one of ‘stringBytes’ fields should
contain a decimal value 67( which represents ASCII character C) .But
that doesn’t seem to be the case. Any ideas what I’m doing wrong?
Q2 - Since String represents a set of Unicode characters, I assume
that in the above example when “ABCDEF” is deserialized from the
viewstate, each character in “ABCDEF” string is represented with two
elements of a ‘stringBytes’ array?
Q3 - Is forms data, thus TextBox1.Text also saved in viewstate – I’m
asking this cos I don’t see a point in saving tha data since form will
save it automatically on postbacks.Are fields that are saved by
postback form automatically not included in viewstate
A) I would assume that postback data ( thus values of <input> controls
that are automatically saved on postbacks) is not also saved into
ViewState, since there wouldn't be any point in doing that
B) If so, then for example TextBox.Text doesn't use ViewState as its
backing store?
much appreciated
EDIT:
I must apologize for not mentioning that