problem about session-state-Collection of common programming errors


  • TheSoftwareJedi
    asp.net vb.net session session-state
    I am storing an array of a custom serializable class in session on my site. When a page on the site changes, suddenly it renders them invalid, and tells me that it can’t cast the type to it’s own type. I assume the class version numbers are changing or something?!I’d appreciate avoiding the “don’t use session” answers, unless it’s a really simple solution. I’m not trying to redesign this whole process.Unable to cast object of type ‘ShipmentPackages[]’ to type ‘ShipmentPackages[]’.Description:

  • Lakeshore
    casting structure session-state
    The ReportInfo is a structure. The structure works fine on one web page but I am trying to use it on another web-page. Here is where I saved the ReportInfo structure to the Session VariableSession[“ReportInfo”] = reportInfo;On the other web-page, I re-created the Structure and then assign the session variable to it, like this…reportInfo = (ReportInfo)(Session[“ReportInfo”]);I get the following run-time error:System.InvalidCastException was unhandled by user codeMessage=”Specified cast is not

  • LukaszW.pl
    c# .net asp.net session session-state
    our web application frequently losses it’s session state (user is being logged out very often). I predict that the reason of such behavior are some exceptions thrown and unhandled in side threads of application or whole application restart.I’m pretty sure that it’s not caused by recycle worker, because it happens in irregular periods of time and many times just after logging into application (after browsking two or three pages).Are there any good ways to diagnose the reasons of session loss? Are

  • François Wahl
    jquery asp.net webforms session-state
    I want to get session in jQuery(v 1.9.1).I used the following code:<script>var testUser = ‘<%= Session[“User”] %>’;alert(testUser); </script>But I get the following error:”The Controls collection cannot be modified because the controlcontains code blocks (i.e. <% … %>).””Description: An unhandled exception occurred during the execution ofthe current web request. Please review the stack trace for moreinformation about the error and where it originated in the code.Exception

  • Daniel Allen Langdon
    asp.net session session-variables session-state
    I am working on an ASP.net web application that was authored by someone who no longer works for my organization.I’ve discovered an odd bug. It is intermittent issue.I have a page in the application called default.aspx. Sometimes, when this page is loaded, the entire session is lost. I see in the debugger that the Session_Start event fires when this happens. Sometimes, the Session_End event fires too, but this doesn’t seem to happen every time.I found a custom sessionState configuration in th

  • Ryan Sampson
    asp.net session-state global-asax
    In the Application_Error method in Global.asax I am trying to retrieve a value from session state.I am able to access session state as long as I throw the exception. EG: thow new Exception(“Test exception”);However if it is an unhandled exception, i get the following error when trying to access session state: “Session state is not available in this context.”.Why the differences in behavior, is there a work around? Thanks.

  • ihorko
    asp.net session timeout session-state inproc
    I use ASP.NET website on IIS7 where in web.config I have:<sessionState mode=”InProc” timeout=”20″></sessionState>But session doesn’t keep 20 minutes, it works very strange, sometimes it expires in 1 minute or less, sometimes just redirect to other page. I need use mode=”InProc”.Who can help me, what is wrong and how to resolve this problem? Thanks!

  • izb
    c# asp.net session iis7 session-state
    I’m making a series of calls to my web application (IIS7 in Classic mode). The first two calls instantiate objects and place them in the Session object.By the time I make a third call, the session is missing an object. I expect there to be 2 of my keys in Session, but there is only 1.It’s almost as though there are multiple sessions being created. One thing to note is that this happens a lot, it is not 100% repeatable, i.e. sometimes everything works fine.The objects are sizeable, but not huge (

  • Jesse
    c# asp.net session-variables session-state global-asax
    A website I am working on is very data centric. Some reports take more than an hour to complete. Whenever a user submits a request for a report, a new thread is created which generates the report. The user is then redirected to a page which says that the report in progress, and to please refresh to download the report. If the user again refreshes the page and the report is still in progress, the same message is shown; otherwise a download link is provided.All report/user relations are saved in t

  • EndangeredMassa
    javascript asp.net-ajax session-state
    I am refactoring a legacy web app. This app has a is using the onload event inside the body tag (On the Master page) to run this javascript script. Note this script tag is after the form element in the doc. I know the syntax looks hideous (or Visual Studio at least tells it is by the squiggles), but I’ll be darned, the thing DOES indeed work.function DisplayPDF() {var strPDFstrPDF = “<%=SESSION(“PDF”)%>”;if (strPDF.length != 0){window.open(strPDF);<%Session(“PDF”) = “”%>} }My questio

  • Pascal
    erlang session-state nitrogen
    I am building a simple web site for my family usage, using Nitrogen/Inets. The current version works as expected as long as I have a single client connected to the web server.If I try to connect a new user, the 2 sessions seems to share the same state variables:browser 1: read the index page, click on connect, and login as user1. browser 2: read the index page, the user is user1 –> not OK- go to login and enter as user2. Seems ok. browser 1: reload the home page –> user changed to user2 –> ve

  • Pankit Kapadia
    php mysql session session-variables session-state
    we moved our website to a new server that came with a new IP address. What puzzles me; the website login sessions do not work on the new server but when I change the database IP to the old server they are working. MySQL Version : Old server = 5.1.58- Community New server = 5.1.68 – CommunityAt first I thought it was a PHP error but I now believe it’s not and suspect its MySQL related. Anyone who knows what might have caused this conflict?Debugging Error : Notice: A session had already been sta

  • hakre
    php session session-variables session-state php-errors
    I was trying to make a shopping cart and got a code from web..<?php session_start(); require_once ‘class/Item.php’; $product_id = $_REQUEST[‘i_id’]; $action = $_REQUEST[‘action’]; $item= new Item();if($product_id && !$item->productExists($product_id)) {die(“Error. Product Doesn’t Exist”); }switch($action) { case “add”:$_SESSION[‘cart’][$product_id]++; break;case “remove”:$_SESSION[‘cart’][$product_id]–; if($_SESSION[‘cart’][$product_id] == 0) unset($_SESSION[‘cart’][$product_id]);