473,394 Members | 1,715 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.

SQL Session State Deserialization ?

WJ
I have problem in using "Deserialization" method to work with SQL Session
State. The session state data was recorded properly to MS/SQL Server
ASPState by a web application. I then attempted to read the session data
back from the SQL server using DataSet. Then call "Deserialize" to reveal
the session class. I got the following error:

"BinaryFormatter Version incompatibility. Expected Version 1.0. Received
Version 623915045.807743536."

Below is the code snippet:

======================
using System; //Sesison Class

namespace wSS
{
[Serializable()]
public class cSS
{
public string FirstName="";
public string LastName="";
public DateTime DOB;

public cSS()
{
}
}
}
=======================

...some codes here to read ASPState data into DataSet called myDS

byte[]b1=new byte[0]; //slot to hold raw data in ms/sql varbinary format
byte[]b2=new byte[0]; //slot to hold raw data in Text (string) format

b1=(byte[])myDS.Tables[0].Rows[0]["SessionItemShort"];
string s=Server.UrlEncode(Encoding.ASCII.GetString(b1));

b2=Encoding.ASCII.GetBytes(s);

//This displayed the correct content of the session class
TextBoxTraceLog.Text+="Check Point#7 - mySQLss="+s+
Environment.NewLine+Environment.NewLine;

MemoryStream ms=new MemoryStream(b2);

BinaryFormatter bf=new BinaryFormatter();
cSS cs=null; //see session class record above

try
{
cs=(cSS)bf.Deserialize(ms); //Here is the bomb
}
catch(Exception be)
{
TextBoxTraceLog.Text+="Check Point#8 - ERROR. Yep,"+
"it is goofed right here-> "+be.Message;

ms.Close();
return;
}

ms.Close();
**********************

PS: If you wish to see the complete sample program, please reply to this
message so that I can attach a 13KB zip file for you to look at.

Thanks for your help,

John

Jul 22 '05 #1
2 3490
Have you found a fix for this?

Aug 3 '05 #2
WJ
No Randy. I donot think it is possible. Only the application that builds the
SS would be compatible and able to reveal the class.

John

<ra********@fnf.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Have you found a fix for this?

Aug 14 '05 #3

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

Similar topics

6
by: Jim Douglas | last post by:
I am starting the analysis and design on how we are going to handle session data. We are on a large web-farm which limits our solutions. The best solution is persisting to MS SQLServer but I'm not...
2
by: genc_ymeri | last post by:
Hi, Well, I'm looking around for another opinion. We have two webservers, the legacy one writen in ASP and the new one in ASP.Net. Once a user logs in the ASP.Net web app, the session of the...
8
by: karahan celikel | last post by:
I realized that when SqlServer mode is used for session management Session_End event is not fired in global.asax. What can I do if I want to do something when a user's session end? Thanks
13
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data...
4
by: tshad | last post by:
I am running with Sql Server and am curious if I should use in-process, State Server, or SQL Server. By default, I assume I am using in-process (I could be wrong here, however). I am not...
1
by: Seetha J | last post by:
I work on a website where users can apply for different types of loans. Depending on the type of loan we store various sets of data in Session state which is maintained in SQL Server. If the user...
3
by: WJ | last post by:
I have problem in using "Deserialization" method to work with SQL Session State. The session state data was recorded properly to MS/SQL Server ASPState by a web application. I then attempted to...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
3
by: Moe Sisko | last post by:
Using dotnet 2.0 sp1, I've got ASP.NET session state working ok in SQLServer mode, but the sessions never seem to expire. e.g if I add a timeout attribute like so : <sessionState...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.