The page requires session state that is no longer available..

When using MobileControls in .Net 2.0 it seems whenever a user's session times out and they do a post back they get the error:

The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit.

If I disable viewstate for the page this error won't happen but I get other errors when asp.net tries to re-bind the values of drop downs.

To reproduce this issue create Default.aspx with

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<mobile:Form ID="MainForm" Runat="server">
<mobile:SelectionList ID="EndPoint" SelectType="DropDown" Runat="server" BreakAfter="true">
<Item Text="Test1" Value="test1" />
<Item Text="Test2" Value="test2" />
</mobile:SelectionList>
<mobile:Command ID="TestPost" Runat="server" OnClick="TestPost_Click" BreakAfter="True">TestPost</mobile:Command>
</mobile:Form>
</body>
</html>
  Default.aspx.cs with:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.MobileControls.MobilePage
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void TestPost_Click(object sender, EventArgs e)
{
}
}

 

and web.config with:

 



<!-- Note: As an alternative to manually editing this file you can use the web admin tool to
configure settings for your application. Use the Website->ASP.NET Configuration option
in Visual Studio.
A full list of settings and comments can be found in machine.config.comments usually
located in \Windows\Microsoft.NET\Framework\v2.0.xxxxx\Config
-->


<configuration>

<appSettings />
<connectionStrings />

<system.web>

<!--
Set compilation debug="true" to insert debugging symbols into the compiled page.
Because this affects performance, set this value to true only during development.
-->

<compilation debug="false" />


<!--
The <authentication> section enables configuration of the security authentication
mode used by ASP.NET to identify an incoming user.
-->

<authentication mode="Windows" />


<!--
The <customErrors> section enables configuration of what to do if/when an unhandled
error occurs during the execution of a request. Specifically, it enables developers
to configure html error pages to be displayed in place of an error stack trace.
-->

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<!--
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
-->

</customErrors>


<!--
FULLY QUALIFY URL FOR CLIENT REDIRECTS
Some mobile devices require that the URL for client redirects be fully qualified.
-->

<httpRuntime useFullyQualifiedRedirectUrl="true" />


<!--
SPECIFY COOKIELESS DATA DICTIONARY TYPE
This will cause the dictionary contents to appear in the local request url querystring.
This is required for forms authentication to work on cookieless devices.
-->

<mobileControls cookielessDataDictionaryType="System.Web.Mobile.CookielessData" />


<deviceFilters>
<filter name="isJPhone" compare="Type" argument="J-Phone" />
<filter name="isHTML32" compare="PreferredRenderingType" argument="html32" />
<filter name="isWML11" compare="PreferredRenderingType" argument="wml11" />
<filter name="isCHTML10" compare="PreferredRenderingType" argument="chtml10" />
<filter name="isGoAmerica" compare="Browser" argument="Go.Web" />
<filter name="isMME" compare="Browser" argument="Microsoft Mobile Explorer" />
<filter name="isMyPalm" compare="Browser" argument="MyPalm" />
<filter name="isPocketIE" compare="Browser" argument="Pocket IE" />
<filter name="isUP3x" compare="Type" argument="Phone.com 3.x Browser" />
<filter name="isUP4x" compare="Type" argument="Phone.com 4.x Browser" />
<filter name="isEricssonR380" compare="Type" argument="Ericsson R380" />
<filter name="isNokia7110" compare="Type" argument="Nokia 7110" />
<filter name="prefersGIF" compare="PreferredImageMIME" argument="image/gif" />
<filter name="prefersWBMP" compare="PreferredImageMIME" argument="image/vnd.wap.wbmp" />
<filter name="supportsColor" compare="IsColor" argument="true" />
<filter name="supportsCookies" compare="Cookies" argument="true" />
<filter name="supportsJavaScript" compare="Javascript" argument="true" />
<filter name="supportsVoiceCalls" compare="CanInitiateVoiceCall" argument="true" />
</deviceFilters>

</system.web>
</configuration>

  

Then browse to Default.aspx, click the button, clear your cookies and session variables and click the button again and you'll get the error.  Any help would be appreciated.

0
crisco96
5/3/2008 5:15:34 PM
asp.net.mobile_devices 3052 articles. 0 followers. Follow

7 Replies
1295 Views

Similar Articles

[PageSpeed] 18
Get it on Google Play
Get it on Apple App Store

This message means that session is expired but page tries to use it. This message is given by page's default viewstate expiring handler.

Add the following method to your page to solve this issue:


public void OnViewStateExpire(EventArgs e)
{
    HttpContext.Current.Session.Abandon();
    this.RedirectToMobilePage("mobile page url here", true);
}

Don't forget to mark solution providing post as "Answered".
It helps others to find correct solutions!

Also visit my ASP.NET blog!
0
DigiMortal
5/3/2008 9:30:26 PM

 Just a slight modification to the code and it works great:

 

protected override void OnViewStateExpire(EventArgs e)
{
	HttpContext.Current.Session.Abandon();
	RedirectToMobilePage("~/Default.aspx");
}
  
0
crisco96
5/5/2008 11:36:26 AM

Hello,

a quick workaround for this issue is to set the sessionStateHistorySize in the Web.config to a hight value:

<mobileControls cookielessDataDictionaryType="System.Web.Mobile.CookielessData" sessionStateHistorySize="100" />
The following blog post explains why this error occurs: Viewstate error in mobile ASP.NET app
 
ttklf4 on Twitter
0
SKT_01
5/20/2008 7:36:57 AM

Hi all,

I have a small problem, please see if any one can help me out.

I have a mobile website wherein i have used Object List and has binded it with values from database. ON selecting a particular record, the details are automatically displayed.

I tested it in .net emulators and worked fine BUT when i tested it in OpenWave simulator i am getting following error.

 The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit.

I am new in web development. Please help

~Satbir

0
satbirhundal
4/24/2009 6:12:10 AM

Hello,

you should not use obsolete software to develop mobile web applications.

The Openwave emulator is completely outdated and doesn't support cookies on localhost. That's the reason of your error. 

 


ttklf4 on Twitter
0
SKT_01
4/24/2009 6:23:52 AM

Ok, thanks.

Can you suggest some simulators which i can use beside .net emulators.

I want that the site should be supported by most of the browsers.

So, Object List works fine in most of the browsers?

~Satbir

0
satbirhundal
4/24/2009 6:32:21 AM

Hello,

one of the best emulators is the iPhone simulator from Apple Inc. which runs only on a Mac. The iphone is one of the most used devices for mobile internet.


ttklf4 on Twitter
0
SKT_01
4/24/2009 8:00:38 AM
Reply:

Similar Artilces:

The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increas
Hi.. I am making a mobile application using .net framework 2.0. My Application has  web farm scenario so for state management  I am using Sateserver in my application. My application runs fine if I dont use web farm scenario But in case of web farm scenario it is giving me error "The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit."   &...

"The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increa
Hi.. I am making a mobile application using .net framework 2.0. My Application has web farm scenario so for state management I am using Sateserver in my application. My application runs fine if I dont use web farm scenario But in case of web farm scenario it is giving me error "The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit." I am not getting why this error is coming ..Though I already h...

The page requires session state that is no longer available
Since deploying my application to my live hosting site and trying the mobile application for the first time on a live mobile phone (Nokia 6310i) I keep getting the following error when moving from one form to another. . . The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit. I have looked through all the posts relating to this and most seem to be addressing this problem when it occurs in developme...

The page requires session state that is no longer available.
Hi i am new in developing a wap application by asp.net . i get the following error   The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit."   Any one help me , How to short this problem. shames web developerTechwave.com This is because you are using Session Variables in ur page. Session is by default 20 minutes... please go through the link below for more r...

MobilePage and SessionState Error "Page requires session state that is no longer available"
I get the "Page requires session state that is no longer available. Either the session has expired, ....." error when I use Inherits System.Web.UI.MobileControls.MobilePage but i can use a page just find that just inherits UI.Page. I've tried setting cookieless=true...setting the historySize greater, and increasing the timeout, nothing works!.  I'm using a blackberry to access the page. Like I said, It's not an issue with a regular page...i can post back and retain info just fine.....but i want to take advantage of the mobile controls....What gives????...

Unable to use session state server....requires session state server version 2.0 or above.
So, I have Windows 2003 IIS latest service packs running. Its running .NET 2.0 and .NET 1.1 applications in seperate application pools. Just today I applied the following patch to the server. (The server is not running any 3.0 or 3.5 applications or application pools)  Microsoft .NET Framework 3.5 Service Pack 1 and .NET Framework 3.5 Family Update (KB951847) x86 Microsoft .NET Framework 3.5 Service Pack 1 is a full cumulative update that contains many new features building incrementally upon .NET Framework 2.0, 3.0, 3.5, and includes cumulative servicing upda...

Page requires session state error if application open in multiple browsers on same machine
I have an asp.net mobile application and I have found that if you open multiple instances of the application on the same machine (on a desktop node), then the exception "The page requires session state that is no longer available..." is thrown.  It would appear that there is only 1 session cookie per machine.  Perhaps this makes sense because on the actual mobile device you can only have one instance of IE running.  Is there any way to allow for multiple instances of the application.  In other words; can you force unique session cookies?  If not, are there...

Session("userCount")=0 in Application_Start
Dear Experts I followed the video tutorial No.2 that demonstrates no of users accessing the website at a given moment. In the global.aspx on Application_Start i have intialized a session variable as follows Session("userCount")=0and am incrementing this in Session_Start event as follows Session("userCount") +=1 When i debug and run the application i get the following error Server Error in '/SessionTest' Applicaiton. Session state is not available in this context (in the Application_Start Event) When i hit the refresh button a couple of times it works. but open another window the cou...

How can Content Page Sub Page_Load read Master Page session state?
Using the ASP.NET 2.0 Session State Server. MasterPage has a radiobuttonlist btnAB with two radiobuttons A and B. I am able to store index and values for A and B in Session("btnABIndex") and Session('btnABValue")   and read these from any Master Page VB sub routine when the radiobutton is initialized on Master Page Load or button is selected forcing page reload. In the Content Page, I added the <@MasterType directive>. But attempting to retrieve Master Page session state information in the Content Page Sub Page_Load, such as showing session state in a label control as a...

Session is not available on some pages.
Hi all, I have developing a simple website using ASP.NET 1.1. i have a login.aspx, where i authenticate user and puts username in session variable as follows:Session["Username"] = "abc";and redirect user to another page named index.aspx. Whenever i access this session variable in index.aspx page as follows: if(Session["Username"] != null){doSomething;} here in index.aspx, it finds this sesion variable. but on some of my pages the above code did'nt find this session variables, don't know why?What i am missing on other web forms?Any suggestions? Regards,Imran Ghani.Imran Abdul Ghani Hi,...

Session availability in base page
I've created a base page on a project I'm working on and I'm having all of the pages within the site inherit from it. I'm trying to include all globally needed functionality in it including session management. The problem I'm running in to is that anytime I use session in the base page in its page_load event I end up getting a null reference exception. For instance I've been testing with this bit of code:        HttpContext.Current.Session["test"] = "test";        Response.Write((string)HttpContext.Current.Session["test"])...

Session to hold page state
Hi I am fairly new to ASP.net and I need some advice on how to write a session that will hold a view of a treeview. What I have  are a number of treeviews that are held in panels, and each panel is visible when the user selects the treeview from a dropdown list. However, I want to keep the user selected treeview visible on the page when the user posts back the page when carrying out another action on the page. Unfortunately, I can't use AJAX or any javascript as it is an internal system, and therefore, I would like to try and do this as a session, but I am not sure how I can ...

Unable to make the session state request to the session state server.
 Hello,           I’m receiving this error when I put my website on production."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 men...

Unable to make the session state request to the session state server
Hi all, I'm working on the website http://universityauction.net and I was using session variables using InProc session mode to manage session state. This worked fine until I put the website in a load balanced environment, as inproc sessions get lost when jumping from server to server. I decided to move to a state server mode, so I changed my web.config to: <sessionState             mode="StateServer"             stateConnectionString="tcpip=123.456.7.8:42424"      ...