This is a migrated thread and some comments may be shown as answers.

Losing session variables?

9 Answers 702 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 21 Oct 2008, 11:02 AM
Hi,

I doubt this is a Telerik Ajax problem but wondered if anyone can shed any light...

Lastest Q2 Ajax build - I am simply loading content from a panelbar link using ajax and then storing the link ID in session for any updates. All is good and everything works as it should locally [iis 5]

However on the live site the session values are being lost and the update does not work. I have outputed the session variables to a label as a test and can see them. But.... If I refresh the page once the sessions variables remain but if I refresh again they are gone!

If I disable ajax then all is OK.

Most odd.

All help most appreciated.

Cheers, Jon

9 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 Oct 2008, 11:31 AM
Hi Jon,

Can you verify if your scenario works properly with plain UpdatePanel. Generally RadAjax for ASP.NET AJAX is based on Microsoft ASP.NET AJAX framework.

Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jon
Top achievements
Rank 1
answered on 21 Oct 2008, 01:23 PM
Dear Vlad,

Thank you.

I am not really able to check that but everything is working fine on the development machine and it was working fine on the live site last week.

Is there anything I should be looking for or asking my hosts to check that may stop these session variables working?

Kind regards,
Jon
0
Maria Ilieva
Telerik team
answered on 23 Oct 2008, 10:21 AM
Hello jon,

Currently we believe that the problem you are facing is mostly framework related. So this verification will be enough to isolate if the issue is caused by RadAjax or this is problem of the framework.

Best wishes,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
efishinsea
Top achievements
Rank 1
answered on 07 Mar 2009, 06:37 AM
HI.
Interesting I found this post. I am using r.a.d.controls (Q4 2006)  and have had issues that I believe are associated with AjaxPanels and my user session vanishing for no apparent reason. I can't reproduce the behavior while debugging, but my live apps have many complaints from users that have logged in to manage site content and such (using these controls wrapped in Ajax Panels) and then unexpected after a save, they are instead logged out, losing unsaved data.

I would be interested to know if there is a work around for this, because at this point, my next step is to start ripping out the ajax panels.

Thanks for anything helpful.
0
Dave Navarro
Top achievements
Rank 2
answered on 07 Mar 2009, 06:04 PM
Hello efishinsea,

I think in order to help you we'll need a bit more information;

Since you're using an older version of the control suite (Q4 2006) what does the rest of your development environment consist of?
Are you using VS 2003?
Are you writing your app with C# or VB?
You're using ASP 1.1?
What server / web server is hosting your application?
I have to assume you're working on an application that cannot be upgraded to a current version of ASP / developer tools?

In any case, my experience with debugging AJAX panels and this type of error has been to start by setting each panel to enable = false. Let the application work with normal post backs see what happens.

If your users don't experince the problem anymore then that will be a clue - only a clue. It still could be related to something other than the AJAX panels - like the web server.

Let us know and thanks,

Dave
0
efishinsea
Top achievements
Rank 1
answered on 07 Mar 2009, 08:18 PM
HI Dave.

No, It's a C# .Net 2.0 app, running the older controls that was originally built in VS 2005, but has since been updated in VS 2008.., (which is sort of irrelevent perhaps)  .. all running on a modern Xeon server w/ Win2003.

The basic setup are some server controls that handle the postback, all wrapped in a Ajax panels : 

 

 

 

<radA:RadAjaxPanel id="RadAjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1" HorizontalAlign="Left">  
 
    <radTS:RadTabStrip ID="RadTabStrip1" runat="server" CausesValidation="false" MultiPageID="RadMultiPage1" 
 
        SelectedIndex="0" OnClientTabSelecting = "OnTabSelectedHandler" OnClientLoad = "TabStrip_OnClientLoad">  
 
    <Tabs> 
 
        <radTS:Tab ID="ts_em" runat="server" Text="Add Events"></radTS:Tab> 
 
        <radTS:Tab ID="ts_view" runat="server" Text="View Events"></radTS:Tab> 
 
        <radTS:Tab ID="Tab1" runat="server" Text="View Calendar"></radTS:Tab> 
 
    </Tabs> 
 
    </radTS:RadTabStrip> 
 
    <radTS:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="tabPageContent">  
 
        <radTS:PageView ID="pageEventManager" runat="server" Width="620px" style="padding:0px">  
 
                .. big web form here ...       
        </radTS:PageView> 
 
         <radTS:PageView ID="pageEventList" runat="Server" Width="620px" style="min-height:300px;">  
 
 
                <asp:datagrid id="dgEvents" ... > 
                        ..datagrid here ..  
 
                 </asp:datagrid>   
        </radTS:PageView> 
        <radTS:PageView ID="CalendarView" runat="Server" Width="620px" style="min-height:300px;">  
 
            <div style="text-align:center;padding:15px;">  
 
                <ctrl:calControl ID="calendarCtrl" runat="Server" ShowDayInfo="true" Width="650" Height="525"   
                        ShowNavigation="true"  ShowDayLinks"false" cellWidth="70" cellHeight="90"/>  
 
            </div> 
 
        </radTS:PageView> 
 
    </radTS:RadMultiPage> 
 
 
</radA:RadAjaxPanel> 
 
 
 
<rada:AjaxLoadingPanel id="LoadingPanel1" Runat="server" Transparency="30" BackColor="#e0e0e0">  
 
    <div style="color:#000000;margin-top:100px;text-align:center; z-index:10;">  
 
        <asp:Image id="Image1" runat="server" AlternateText="Loading..." BorderWidth="0px"   
            ImageUrl="~/RadControls/Ajax/Skins/Default/loading6.gif"></asp:Image> 
 
    </div> 
 
</rada:AjaxLoadingPanel> 
 


This is just one example, but there are several variables of pages like this where the mysterious vanishing session occurs. Most of the time, everything works fine, but regularly, at inexplicable intervals, the user session vanishes, causing the validated login to fail, and the user is sent back to the login screen.  I have traced out the process, and nothing is killing the session from the code, it's just failing (HttpContext.Current.Session["loggedin"] == nulltest and timing out.

So, I've just taken the ajax panels out of the code for now to see if anything improves session-wise.

Thanks.

 

 

 

0
Dave Navarro
Top achievements
Rank 2
answered on 07 Mar 2009, 09:46 PM
Hello efishinsea,

So, nothing looks 'out of the ordinary' but something you said / wrote sounds like a clue;
You wrote; Most of the time, everything works fine, but regularly, at inexplicable intervals, the user session vanishes, causing the validated login to fail, and the user is sent back to the login screen. 

So, what works at regular intervals? What would clear your session? IIS 6 could be one to check out.
If you're using <authentication mode="Forms"> along with <!--<sessionState mode="InProc" /> --> then you may see your sessions get cleared when the web server recycles because they are set to be "InProc".

This was news to me. Not long ago we saw our users getting logged out at the same time and eventually discovered that our IIS 6 server was set to "recycle" every 20 minutes or when 5MB of data passed within 1 minute. When the server recycles the sessions "InProc" are cleared -  or as you put it "vanish".

These settings were a little low (in my opinion) so we took a few steps to address them. One additional step we took was to put the session state in SQL as such; <!--<sessionState mode="SQLServer"  /> -->

Now, there is a lot more to this statement and the others I've placed in this reply so please don't attempt to take the tiny snippet of html and use them. I'm only adding it in so I can make a clear point. You'll need to use a complete statement for each.

Anyway, now that we've moved our session states to SQL the web server (IIS 6) can recycle as needed without impacting our users. I actually wrote some code to log the users in automatically if the server recycles. Of course, our users are only allowed to use our site with encryption (https:) and we're teaching them to be aware of their browsing habits so they won't get their session hijacked.

But that's another story.

Check out your web server and see if it's recycling on the same schedule as your users are getting dropped.

Hope this helps,

Dave
0
Sam Miller
Top achievements
Rank 1
answered on 23 Mar 2009, 10:14 PM
Hmm. I have thought about that, and wonder if this may  be do to something similar happening with whatever due to the configuration of the shared hosting environment I use for this application.

I will check with them and see.
0
Bill
Top achievements
Rank 1
answered on 23 Jan 2010, 07:52 PM
Here's a solution to consider:

First of all I used RadAjaxPanel wrapped around a Login Control: Login1

Then placed a javascript on the masterpage or in the <head></head> tag as so:

<%@ Page Language="C#" MasterPageFile="~/MHEControl.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" Title="MHEControl: Login" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">  
    <script language="javascript" type="text/javascript">  
// <!CDATA[  
 
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);  
 
function EndRequestHandler(sender, args)  
{          
           if (args.get_error() != undefined)  
           {  
             args.set_errorHandled(true);location.reload(true);  
           }  
             
}  
 
// ]]> 
</script> 
This will prevent that session dialog box error from happening

Only problem is that I am having a LoginView with a template the destination page in some browsers with that error you've all mentioned.  Works fine with Login control nevertheless I suppose.

Hope this helps

Created in: VS2005 .Net 2.0
Tags
Ajax
Asked by
Jon
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jon
Top achievements
Rank 1
Maria Ilieva
Telerik team
efishinsea
Top achievements
Rank 1
Dave Navarro
Top achievements
Rank 2
Sam Miller
Top achievements
Rank 1
Bill
Top achievements
Rank 1
Share this question
or