Session State Problem in ASP.Net
Q)i am creating one website. then i am using the Asp Session state in web.Config File... then
sqlConnectionString="data source=hi; user id=sa; password=sa; database=ASPState" cookieless="false" timeout="20" />
Whenever i am login into web page then One error is coming like this .....
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
How to slove this BUG....Plz Help
Answer----1)
Persisting Session Variables to SQLServer:
Using a state server lets all the servers in a Web farm share state information; however, that does not prevent state data from being lost if the state server crashes. You can persist state information and keep it accessible (even after a reboot) by storing the state data in a SQL Server database. To do that, modify the web.config file as follows:
mode="SQLServer"
sqlConnectionString=
"data source=127.0.0.1;user id=sa;password="
timeout="20"
/>
The sqlConnectionString attribute contains the IP address of the machine running SQL Server (127.0.0.1 in this case) as well as the user ID and password required to access the SQL Server.
Next, you need to set up the necessary database and tables to store the state information. Fortunately, ASP.NET provides an installation script to help you setup the database, ASPState, and its tables. To use the script, enter the following at a command prompt (you need to enter the following on a single line):
D:\WINNT\Microsoft.NET\Framework\v1.0.3328>
osql -S localhost -U sa -P installsqlstate.sql
The state information is actually stored in the tempdb database (not ASPState), in the ASPStateTempApplications and ASPStateTempSessions tables. The ASPState database contains several stored procedures that allow ASP.NET to perform housekeeping tasks, such as retrieving session variables and removing expired Session variables.
And Check if any Session Class Declared in ur Code Behind Code .. if u r create a Class Then Put [Serialazable] kayword
Answer----2)
pls visit the following link
http://msdn.microsoft.com/en-us/library/87069683(VS.71).aspx
if any Doubt plz wraite Comment
Whenever i am login into web page then One error is coming like this .....
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
How to slove this BUG....Plz Help
Answer----1)
Persisting Session Variables to SQLServer:
Using a state server lets all the servers in a Web farm share state information; however, that does not prevent state data from being lost if the state server crashes. You can persist state information and keep it accessible (even after a reboot) by storing the state data in a SQL Server database. To do that, modify the web.config file as follows:
sqlConnectionString=
"data source=127.0.0.1;user id=sa;password="
timeout="20"
/>
The sqlConnectionString attribute contains the IP address of the machine running SQL Server (127.0.0.1 in this case) as well as the user ID and password required to access the SQL Server.
Next, you need to set up the necessary database and tables to store the state information. Fortunately, ASP.NET provides an installation script to help you setup the database, ASPState, and its tables. To use the script, enter the following at a command prompt (you need to enter the following on a single line):
D:\WINNT\Microsoft.NET\Framework\v1.0.3328>
osql -S localhost -U sa -P installsqlstate.sql
The state information is actually stored in the tempdb database (not ASPState), in the ASPStateTempApplications and ASPStateTempSessions tables. The ASPState database contains several stored procedures that allow ASP.NET to perform housekeeping tasks, such as retrieving session variables and removing expired Session variables.
And Check if any Session Class Declared in ur Code Behind Code .. if u r create a Class Then Put [Serialazable] kayword
Answer----2)
pls visit the following link
http://msdn.microsoft.com/en-us/library/87069683(VS.71).aspx
if any Doubt plz wraite Comment
3 Comments:
buddy, this is very common and small issue, and it may have thousands of solutions.
By Viral Kothari, At June 18, 2008 at 8:45 AM
This comment has been removed by the author.
By Viral Kothari, At June 18, 2008 at 8:50 AM
This is a nice article..
Its easy to understand ..
And this article is using to learn something about it..
c#, dot.net, php tutorial, Ms sql server
Thanks a lot..!
ri80
By Muhammad Azeem, At April 24, 2011 at 6:47 PM
Post a Comment
Subscribe to Post Comments [Atom]
<< Home