.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Help with THREADING and SESSION STATE

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
 
I created a page which runs a THREAD.  Unfortunately, at the end of the THREAD which is designed to populate a table, an error is produced.  It says that the SESSION STATE CAN ONLY BE USED WHEN ENABLESESSIONSTATE IS SET TO TRUE.  I added the ENABLESESSIONSTATE to my page directive.  However, it seems that this does not suffice.  It also says the I need to add a CUSTOM SESSION STATE module in the CONFIGURATION section.  Is there an example of where I do this in the WEB.CONFIG.  I need a fairly detailed WEB.CONFIG as I don't want to break what I have at the moment. TIAJohn


View Complete Post


More Related Resource Links

SQL Server Session state problem.

  

Hi to all,


I have some things that I want to know. I am right now using a free asp.net webhosting ("somee.com"). The problem is that when I am visiting a page, there's a tendency that values stored in my session variables are lost. Therefore, it causes an error when the requested page is loaded.

1. I am thinking of using sessionState mode="SqlServer". Will it solve my problem?

Actualy Im working on it but Im having problems when connecting to the sql database.

2.  Is that a problem in the webhost?

3. Do free webhosting sites provide allow session state in the sql server?. Because ive tried it locally into my computer and error say's i should intall the ASP.NET Session State SQL Server version 2.0 or above.




Best Practices: Fast, Scalable, and Secure Session State Management for Your Web Applications

  

ASP.NET provides a number of ways to maintain user state, the most powerful of which is session state. This article takes an in-depth look at designing and deploying high-performance, scalable, secure session solutions, and presents best practices for both existing and new ASP.NET session state features straight from the ASP.NET feature team.

Mike Volodarsky

MSDN Magazine September 2005


Taming the Stateless Beast: Managing Session State Across Servers on a Web Farm

  

Running a Web farm means managing session state across servers. Since session state can't be shared across a Web farm with Internet Information Services 5.0, a custom solution is required. One such solution using a tool called the session manager is described here. The article begins with a description of the SQL Server database used to store state information, the stored procedures used to update it, and the retrieval of session data. ASP code drives the session manager tool and the COM and COM+ components that run the stored procedures.

John Papa

MSDN Magazine October 2000


Session State Problem

  

Hi,

 

I just for the first time into a session state problem. So I am hoping someone

here has the answer.

 

I have written an ASP.Net website and tried to implement the common poor mans online user count.
The problem I am having is the following.

On App_Start I create a variable and assign it the value of 0;

Then increase the number on session_start and decrement on session_end.

On my local IIS it works perfectly from IE8 and Opera. The value increments correctly.
As soon as I upload to my live server. The value increments on every link I click and every page refresh when I test with IE8.
This does not happen when testing with Opera.

Could someone please shed some light on the subject.

 

Thanks

 

Louis Lews


Good news for those of you who get "Unable to make the session state request to the session state se

  

Dear all,

Due to the known problem of session variables getting lost if using InProc-server during frequent changes in development, I had to choose between SQL and ASP.NET State server, so I opted for the second. Initially, all fine, but after using it for a few days, I started to get this error:

 Server Error in '/cv2' Application.
Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the clie

How to use cookieless session state...

  
I want to know how its work and it advantage and disadvantegePls explain me with example

Session State for Listview Items?

  
Hi, I have a listview control, in it each item will have a checklist eg - Pass / Fail which will then have a label displaying the selected value. I also have datapager wired up to the listview. When i toggle between the datapages and toggle back, any result previously submitted will be wiped. I am thinking i should be using session state to temporarily store then info, and then once the session is finished use a submit button to send all values and ids into an xml. 1. Is this the right way of approaching the situation? 2. How would i specify session state for listview items, eg would i angle it through a itemdatabound event or the application itself?   Any assistance and advice would be appreciated as i have only started looking at state management and xml storage.  

Accessing Session State in a User Control

  
We have a web site that implements a custom SiteMapProvider using a User Control added in the master page. I need to be able to limit the sitemap nodes added depending on the logged in user, that is, certain users should not see certain sitemap nodes. Currently, the login processing code determines if users are in the certain category or role and then sets a value in session state, for example, Session["UserInRoleXXX"] = "Yes"; I tried changing the code in the user control to check the session state, but I got the following error: NullReferenceException ... Object reference not set to an instance of an object." Can session state be accessed in a user control? If so, how? If not, any suggested solutions? Thanks in advance for any help.

Session state and MVC

  
I'm trying to maintain session state for a user with MVC.  What is the best approach?

What are the benefits of using ASP.NET Session State in a Web Service

  
I have a question regarding session state usage in a  Web Service method. I thought about this situation as I came across an article http://msdn.microsoft.com/en-us/library/aa480509.aspx Situation is that A. There are web service methods which are being exposed. One web method to store value in a session state and another to get value from session state. B. There is another asp.net website which calls the above web methods.        B                    ----------------------------------->       A (Another ASP.NET Website)                 (WebService hosted in an ASP.NET website)   Questions: Does webmethod can store data in a session variable in Webservice application's IIS (in Proc)? I tried this (refer below code snippets) but I was not able to store and get data thru webmethods into/from state. Why?? What is the use of storing it in the state of the Webservice's website IIS (in proc). Will there be any session objects create due to any web service calls from clients? What are the benefits of saving a value in WebService's session, not in the calling website's session. A WebService's webmethod can able to use session state, does that mean that a session will b

What are the benefits of using ASP.NET Session State in a Web Service?

  
I have a question regarding session state usage in a  Web Service method. I thought about this situation as I came across an article http://msdn.microsoft.com/en-us/library/aa480509.aspx Situation is that A. There are web service methods which are being exposed. One web method to store value in a session state and another to get value from session state. B. There is another asp.net website which calls the above web methods.         B                    ----------------------------------->       A (Another ASP.NET Website)                 (Web Service hosted in an ASP.NET website)      Questions: Does web method  can store data in a session variable in Web service application's IIS (in Proc)? I tried this (refer below code snippets) but I was not able to store and get data thru webmethods into/from state. Why?? What is the use of storing it in the state of the Webservice's website IIS (in proc). Will there be any session objects create due to any web service calls from clients? What are the benefits of saving a value in Web Service's session, not in the calling website's session. A Web Service's web method can able to use sessio

Session state just got screwed up between pages

  
I had a website that was working fine for months and now an external consultant played with IIS 6 and now every once in a while when I open a new page, the session is gone (same browser, sometimes a new window, sometimes the same).   As far as I can see the timeout is correct when I ping the Session.Timeout on page load.   What could be causing this??

Storing large data in Session State

  
Hi, We have a scenario where we need to store large tables of data on Session in asp.net page. on a highlevel we have to store following data  1> A table (table 1) with 1000 rows and 8 to 10 columns. 2> A table(table 2) with 500 rows and 8 to 10 columns (actually user can add the data from table 1 to table 2, so as user keeps on adding from table 1 we remove the data and put it in table 2) 3> Another table(table 3) with 1000-1200 rows each having 3 columns. We are having a webfarm, so we need to store it in either SateServer of Oracle DB, please advise which one is better. What would be the performance implications of storing such huge data on the server. One more thing is at any point of time max of 70 -80 people will be accessing our website, so will this cause any performance degradation? Thanks in anticipation Harsha

Session State throws error in ASP.NET Site Pages for SharePoint 2010 portal using Visual Studio 2010

  

I'm developing Visual Studio 2010 solution for site pages. I’ve created Site Pages in SharePoint 2010 and I’m trying to access Session variables in code behind in ASP.NET but it throws the following error.

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.

I set the page directive as enableSessionState=&quo

IHttpModule and session state

  

I have a need to encrypt query string elements but I want to use a per session key.  I don't want the user to come back later with the same querystring and be able to use it again.  I created an IHttpModule for decrypting the querystring elements (derived from QueryStringModule.cs that's floating around).  The problem is the first time through the session is null (as expected since it is a new page request).  Is there a way to force session to be active here?

 

public void Init(HttpApplication context)
{
    context.BeginRequest += new EventHandler(OnBeginRequest);
}

void OnBeginRequest(object sender, EventArgs e)
{
    HttpContext context = HttpContext.Current;
    string key = (string)context.Session["sessionkey"];
    ...
}

In this case, context session is null.

Any advice?


Session State in ASHX file

  

Hi People,

I have been trying unsuccessfully to retrieve a Session varaible from within an ASHX file that i'm using to build an XML file.

What I am trying to achieve is quite simple really.

My ASHX file is used to dynamically build an XML file so that I can then bind it to a TreeView control later on. However the dynamic part isn't quite working because the ID that I need from the session seems to not be passed into the ASHX file.


I have tried using the following methods to do this:

1) Include interfaces IRequiresSessionState and IReadOnlySessionState

2) Tried accessing the value like this: Session["ID"] or context.Session["ID"] or HttpContext.Current.Session["ID"]

I am setting the Session variable in the MasterPage's code behind.


Can anyone help?

Thanks,

Graham.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend