473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why does viewstate deserialize object as hashtable?

I have an object that inherits from hashtable and is serializable to be
stored in the viewstate, but when I retrieve it from viewstate, it is
converted into a hashtable, why won't it stay as the original object?
thanks

Nov 19 '05 #1
3 1664
Hi,

Your question is confusing. Define what means "it is converted into
HashTable" (post the code). Do you mean that you are handed with Hashtable
instance even though it is derived from HT (did you do casting to the
derived type after getting object from the Viewstate and got exceptions)?

I'd like to see the sample code. And you did specify serialization by
appending Serializable attribute or did you reimplement ISerializable
inetrface implemented by HT?

One reason I'm thinking for this, is that Hashtable implements ISerializable
interface, and I suppose it could be possible that its default
implementation is used (which would instantiate Hashtable), unless you
redeclare it. (though it sounds weird)

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU

<jw*****@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I have an object that inherits from hashtable and is serializable to be
stored in the viewstate, but when I retrieve it from viewstate, it is
converted into a hashtable, why won't it stay as the original object?
thanks

Nov 19 '05 #2
PJ
> One reason I'm thinking for this, is that Hashtable implements
ISerializable
interface, and I suppose it could be possible that its default
implementation is used (which would instantiate Hashtable), unless you
redeclare it. (though it sounds weird)


That's exactly right. Asp.net calls the ISerializable methods and since you
do not override the appropriate methods in your derived object, it uses the
hashtables implementation...which, of course, only serializes and
deserializes itself.
Nov 19 '05 #3
when i say converts it to a hashtable, i mean that the type of the
deserialized object is Hashtable, not my original object.

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ce | last post by:
Being a newbie regarding serialization and memorystreams, I was trying to see if i could improve page performance (avoiding going to the db on a postback) by saving my serialized business object in...
7
by: GS | last post by:
Hello, I'm receiving The state information is invalid for this page and might be corrupted error message when running code below. This happens on second post back. Why is it happening? My...
2
by: mohaaron | last post by:
Can anyone tell me why when trying to use the following code to deserialize the viewstate it takes a long time with a large viewstate. This really surprised as the viewstate is big, but not that...
1
by: Irene | last post by:
Hello all! I'm creating a web site in ASP.NET (VB.NET). One of the requirements was to allow users to create orders going through several steps. A must have is to have an option to save the work...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.