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


Top 5 Contributors of the Month
ASPEvil
Ashutosh Jha
Jean Paul
satyapriyanayak
SP
Post New Web Links

Session Timeout Problem

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net
 

I have a website that allows a user to type a blog if they are logged in. I use Forms mode for authentication. What I have found is if the user logs in and begins typing a blog then they stop and take a break, go to lunch and do whatever. When they finally come back they begin typing again but when they go to "post" back to the server their session has timed out and they get errors and ultimatly have lost everything they have typed in.

How do I solve this problem? Do I post something back on a timer every so often to prevent the timeout via javascript or something?
Or is there something I can do to detect "no activity" and show a "screen saver" type message where they have to click a button to return and that could re-establish the connection and return them to the page they were at with all its content in tact?

Example code may be required. I know very little about javascript and nothing about how to detect "no activity".

Thanks for your help.
wayne

 




View Complete Post


More Related Resource Links

Ajax Session timeout problem

  
Hi,  I have some problems when using AJAX with updatepanels. I have an ASP.NET webapplication with a login that uses form authentication with the timeout set to 5 min. After 5 min of idle the site should be redirected to the login.aspx page. My problem is that after using the site for 5 minutes when clicking on contents inside an updatepanel I get a messagebox with the following error: A Runtime Error has occurred.Do you wish to Debug? Line: 4723Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12031  I think that it has something to do with the ajax updatepanel since when I remove the updatpanels this problem does not appear. Instead the site is redirected to login.aspx as expected. When searching on the problem on google I see alot of people having similar problem, but I haven't found suitable solution. Any suggestions?

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.




Session problem with display of image in row of reportviewer

  

Hello techies...

I am new to this sql reporting service. But anyhow by surfing I am able to bind the report but i was stuck in image display.

Anyways, i also managed that. But the real problem is whenever i was keeping a image control in rdlc report i was having session prob. If i remove the image control then as usual report works fine.

Please suggest me some solution.... either for session problem or for image display. I am keeping the image name in database but for binding the rdlc report i am using a store procedure which return the path (static) concating with the image name(kept in database).

Hope to find a solution .....


Problem with Session and PageMethod

  

Hi All,


I'm trying to show some data in the update panel refreshing every second using page method. Everything works fine until I introduce Session. As soon as I save some data into the session my Ajax Page method is not called every second. Here is the complete code

Test.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
    <script type="text/javascript" language="JavaScript">
        function UpdateStatus() {
            setTimeout("UpdateStatus()", 1000);
            PageMethods.DisplayCurrentStatus(ShowStatus);
        }

        function ShowStatus(sCurrentStatus) {
            document.getElementById('lblStatus').innerHTML = sCurrentStatus;
        }        
        
    </script>    
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True&q

Session Problem with IE 6 and IFrames

  

hi folks

i've a problem with session objects in my asp .net 2.0 webapplication. when i open my webapplication in a IFRAME and IE, it doesn't work, because my session object is NOTHING.

what's wrong ? what can i do ?

Kind regards
Phil


How to set session timeout and clear session in asp.net C# ? And kill session when close the web app

  

hi ,

How to set session timeout and clear session in web.config and login.aspx  ? And when we close the web application , the session must be cleared ?

I have use session.abandon as per below but is not working . Pls advise .

 

        protected void btnLogout_Click(object sender, EventArgs e)
        {
            Session.RemoveAll();
            Session.Abandon();

            Response.Redirect("LoginPage.aspx");
        }

 


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


session lost problem

  

hi there,

i have an application that uses sessions.

i have set at the web.config: 

<forms loginUrl="Default.aspx" protection="All" timeout="30" name=".ASPXFAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="Default.aspx" cookieless="UseCookies" enableCrossAppRedirects="true"/>

and at the global.asax.vb

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        Session.Timeout = 30

end Sub

and at default.aspx.vb

Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As EventArgs)
        Session("userName") = Login1.UserName
        Session.Timeout = 30 ' minutes of session '

    End Sub

At a local iis on windows xp works fine,

but when i publish it at the webserver i am redirected to the default page after about 30 sec!!!

any ideas?

thanks


session timeout

  

hi there,

is it possible that session time out is calculated in seconds and not in minutes?

i am setting it at web.config, global.asax, default.aspx and at the web server to 30 (minutes) and session last exactly for 30 seconds.

Thanks

 


Session Timeout increase to 2 hours.

  

Hi,

    for Business needs i am planning to increase the session timeout to 2 hours(120 min) in one application, i am using sql server session state. if i increase to 2 hours of session time out, how it will effect the performance of application and web server.

   Could any one help me on this.

 

Regards,

Karthik.R

 

 


Warning users before Session Timeout

  
Hi, In my web application, I want to alert users 5 minutes before their session timeout. If the users want, they can either extend their session or ignore the message - in which case after session timeout they will be redirected to the login page (I'm also using forms authentication in my site, so have set the authentication cookie expire time to the session timeout). I know I can do the alert with window.setTimeout, but I want to get user's respond and refresh the page if they want a session extension. How can I do that, in which event and whether I can do this in C# code behind. And also, should I implement this in the base page or somewhere else? How can I implement the auto page refresh - should I use a hidden button and click it from Javascript? It's great if someone can give a sample code for this.  

Timeout child window problem

  
The users of our site have reported a problem where when you have a child window open and click around in the main window, the child window will time out even though there is activity in the main window. We use an encryptedFormsAuthenticationTicket and http cookie that expires after a timeout period using Response.Cookies.Add(authCookie). Is there an obvious problem from this description? We are using the back button prevention like so:   Response.AppendHeader("Cache-Control", "no-cache") Response.AppendHeader("Cache-Control", "private") Response.AppendHeader("Cache-Control", "no-store") Response.AppendHeader("Cache-Control", "must-revalidate") Response.AppendHeader("Cache-Control", "max-stale=0") Response.AppendHeader("Cache-Control", "post-check=0") Response.AppendHeader("Cache-Control", "pre-check=0") Response.AppendHeader("Pragma", "no-cache") Response.AppendHeader("Keep-Alive", "timeout=3, max=993") Response.AppendHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT")  Could this cause timeout problems in child windows? Any suggestions?

Problem: Experiencing a delay/timeout in retreiving data

  
Hi, I have a simple question. We had a application before working perfectly. we moved the application and the WCF into new server. unfortunately we are experiencing some delays/timeout in retreiving data . what do you think it cause?3 stars and a sun

Asp.net Pages Getting session timeout

  
in my website there is a folder which requires authunteication/jobseekers/but after sometimes, the session("cid") is "", that means there is no value of candidate in the session("cid") field, but iam able to browse the jobseeker folderiam not using asp.net default authenticaiton method, iam manualy authenticating themnow my concern iswhen there is no value in session("cid") the user must be prompted to login againhow can that be doneif put a check in master page for session("cid")but i also have login.aspx in that jobseekers folderso do i need to have login.aspx page outside the jobseeker folder and shall i write session("cid") in master page
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