I have confronted with some difficulties: I have a task to extract logged user session data from database to collect statistic information from SPPS 2003 (Sharepoint Portal Server) for analyzing purposes.
Information I need looks ordinary enough: username, datetimes of user log in and log out, etc..
After digging hundreds of articles and docs, I had found out that session object is serialized into database record. It is ok, but I found no decription about where this data can be stored or how can I have access to it.
What can I do with it or what should I read for achieving my object?
Thanx.
![]() |
0 |
![]() |
HI, Yniil:
To maintain session scope, session-state providers store session information uniquely for each application. This allows multiple ASP.NET applications to use the same data source without running into a conflict if duplicate session identifiers are encountered.
Because session-state store providers store session information uniquely for each application, you must ensure that your data schema, queries, and updates include the application name. For example, the following command might be used to retrieve session data from a database.
SELECT * FROM Sessions
WHERE SessionID = 'ABC123' AND ApplicationName = 'MyApplication'I found a solution to share with you but i have not tested it now.
Serialized data can be saved in database and it is perfect for shopping carts or reletional datasets used on your site etc. Trick is to serialiaze it as array byte and you can save it to database using binary field like image, etc'''''
Imports System.Runtime.Serialization.Formatters.Binary'''''
Public Function serializeDatatable(ByVal dt As DataTable) As Byte()
Dim objMemoryStream As MemoryStream
Dim objBinaryFormatter As BinaryFormatterobjMemoryStream = New MemoryStream
objBinaryFormatter = New BinaryFormatterobjBinaryFormatter.Serialize(objMemoryStream, dt)
objMemoryStream.Close()
Return objMemoryStream.ToArray
End Function
Public Function deserializeDatatable(ByVal arrByte As Byte()) As DataTable //you can transfer the serialized data field from db to the arrByte
Dim objMemoryStream As MemoryStream
Dim objBinaryFormatter As BinaryFormatterobjMemoryStream = New MemoryStream(arrByte)
objBinaryFormatter = New BinaryFormatterDim dt As DataTable = CType(objBinaryFormatter.Deserialize(objMemoryStream), DataTable)
objMemoryStream.Close()
Return dtI hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance
Best Regards,
__________________________________________________
Sincerely,
Rex Lin
Microsoft Online Community Support
If there is any question or the issue is not resolved, please feel free to mark the thread as not resolved
![]() |
0 |
![]() |
Hi, Rex.
Thank you very much for your response, but I have no idea, where session data in database is stored, though I have ASPState database on my server. I have set "Sql Server" mode in ASP.NET Configuration in tab "State Management" (data source=localhost;Integrated Security=SSPI).
In fact sessions, if set no persistent storage (and sessions are deleted with mssql server reboot), should be stored in tempdb database, where I have "ASPStateTempApplications" and "ASPStateTempSessions" tables. But they are always empty.
Could it be the problem? If yes, how can it be solved?
![]() |
0 |
![]() |
HI, Yniil
First, make sure that the SQL Server agent is running as it manages these jobs to maintain the session state in your SQL database.
Second, When you use the default InstallSqlState.sql and UninstallSqlState.sql script files to configure ASP.NET SQL Server mode session state management, note that these files add the ASPStateTempSessions and the ASPStateTempApplications tables to the tempdb database in SQL Server by default. Furthermore, if you restart SQL Server, you lose the session state data that was stored in the ASPStateTempSessions and the ASPStateTempApplications tables.For additional information about how to run alternative scripts to configure persistent SQL Server session state management so that the session data is not lost when you restart the server, click the article number below to view the article in the Microsoft Knowledge Base:
http://support.microsoft.com/kb/311209/EN-US/ HOW TO: Configure ASP.NET for Persistent SQL Server Session State Managementhttp://support.microsoft.com/kb/317604 HOW TO: Configure SQL Server to Store ASP.NET Session StateIf i misunderstand you about your question, please feel free to correct me and i will try to help you with more information.
I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance
Best Regards,
__________________________________________________
Sincerely,
Rex Lin
Microsoft Online Community Support
If there is any question or the issue is not resolved, please feel free to mark the thread as not resolved
![]() |
0 |
![]() |
Hi again, Rex!
After some time passed, I realized the fact that I could explore the false direction to solve the problem.
In fact, I have the task to extract user session data to collect statistics. Does these tables store the data I need? Or I am wrong from the beginning?
The information you gave me is very helpful, but it could not solve the problem :(
![]() |
0 |
![]() |