473,379 Members | 1,381 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,379 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 3487
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.