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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Session expire on window close

Posted By:      Posted Date: October 26, 2010    Points: 0   Category :ASP.Net


I need your help badly. I want to expire session when wndow is directly closed. I have master page.


View Complete Post

More Related Resource Links

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)



How to Use Window.close() in C#


Hello Alll

Please Tell me  How to Use Window.close() in C#.. In this case i have to handle both serverside event and client side..


Refresh parent window and close popup window.


Hi All,

I've been spent the last couple hours trying to work on this issue. I an creating Facebook Oauth stuff, when i click on parent window. The popup shows the Facebook login, when i logged in with my details, it redirects to my site. But i need to close this popup after returning and refrsh the parent window.

can you please provide me this kind of stuff. i already spent whole day in this... Sealed Cry

If i could solve this then i will go for another logic but stucked on 1st step.



i make a web site using frame but session is expire Error message is my Config file is attache

i make a web site using frame  but session is expire message is Object reference not set to an instance of an object Description: HTTP 500. Error processing request. Stack Trace: System.NullReferenceException: Object reference not set to an instance of an object at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000] in <filename unknown>:0 at System.Web.UI.Control.LoadRecursive () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessLoad () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessPostData () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 My Web Config file is<configuration>    <!-- store the database connection info here -->     <appSettings>        <add key="sBook_StoreDBConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Program Files\CodeCharge\Examples\BookStore\BookStore_MSAccess.mdb;Persist Security Info=False" />            </appSettings>  <system.web>  <httpRuntime executionTimeout=&quo

Retain previous selection in a modal window when it is reopened within same session

Hi ! I have a modal which have a listbox inside it. I am passing the values through a session to the parent page. Suppose, i made few selections on the modal page and i closed it. I want to see the same selection on the modal page once i reopen the modal window Is there any possibility to retain the previous selection in a modal window? I used <body onload="window.focus();" onblur ="this.focus" > but this doesn't work Any idea please?  

Modal Window won't close

I have a linkbutton at the end of each record of a gridview that has a client side javascript invoked on the OnClientClick event. It displays a popup modal window. This is applied to each record in the gridview databound event. lnkbtnAppts.OnClientClick = String.Format("javascript:window.showModalDialog('CAPAC_Appointments_Modal.aspx?Client_Name={0}&Client_SR={1}','','dialogWidth:800px; dialogHeight:600px; center:yes');", Client_Name, Row_SR) On the modal window, I have a standard server side button, with attributes applied to run a client side javascript to close the popup window. Seems fair enough! btnClose.Attributes.Add("onclick", "javascript:window.top.close()") The problem is it closes the window, but the popup immediately appears again. The second time I can close the popup window? Not good! Thanks    

When Session is expire

i am using frame in Web Site . but session is expire than Login Page open in within frame how to open Login Page in Seprate Window  and my main frame page is not show

Session expire error

Hi,I have Store procedure its take some times to execute, While its executing my session expires the browser seems to freeze and the user do not seem to know what to do. Instead, Could i please re-direct to the login page with a red line message saying "Your session has expired. Please login again."whats the best way to do that?krdslakmal

Clearing Session Data from Modeless Popup window.


I am using Post method to generate crystal reports. The user requirement is to show the report in a modeless pop up screen. 

The session data needs to be cleared as it may at times contain a very large dataset.  

One implementation I have placed in at present is - placing a button "Close Button". When user clicks close button, I am able to clean up the session content as well as close the window.

The issue I am facing is to get the handle of the modeless window when it is closed using the x button. Also, since the pop up window is modeless, the user might have moved to another screen, henceforth the parent of the popup window is already changed or out of context.

How do we clear the sesssion content when the issue condition arises?

Please provide suggestions.

Close a Popup Window page from Code Behind


Good Morning,

I am using the ClientScriptManager class to call a java alert from Code Behind when a condition is not met. This is being done from a page that is already a JavaScript pop up. When the alert is responded to, I want the script to close both the alert AND the page that generated the alert. Everything works as designed until I close the alert window...THEN the user is also forced to close a second page (the original generating page for the alert) to return to the starting point. This seems cumbersome and unprofessional. I Googled a bunch of stuff but cannot seem to come up with just the right one. What I have currently is below. I appreciate any assistance...Thank You, Pat

        if (RadioButtonSelect.Checked == false)
string msg = "My String";
ClientScriptManager script = Page.ClientScript;
if (!script.IsClientScriptBlockRegistered(this.GetType(), "Alert"))
script.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('" + msg + "')", true);

want to disbale Java script message before close window




Hi I have Java script ,

when i close my .aspx page getting yes/no message, i want do disable this message , dont want any message befroe close my window


how i can do


How to close individually the multiple open browser window using c# code?


Hello guys,

The scenario is I have multiple open browser window (IE or Firefox) then I want to close the specific browser individually.

I have tried to lookup the applications running from the task manager but I can't get the running application from the task manager > application > task.

I have added two references below to lookup the task running applications.

using System.Diagnostics;
using System.Threading;

Anyone can help me on how to close individually the specific open browser window using c# code event.


window.close() not works in firefox


good day to all,

Below mentioned methods does not work in Firefox.

function CloseWindow() {
      if (confirm('Would you like to close the window?')) {

          window.opener = null;

Please provide me solution.

Thanks to all of you.

Session expire before timeout


Hi all,

I set session timeout ="200".

But my session automatically time out within 5 minute.

plz suggest me what i do for fixed session timeout?






Session expiry on closing browser window

The article Session expiry on closing browser window was added by RustyIron on Saturday, February 26, 2011.

Ever wondered what occurs when a user closes his browser window. For the time, the user was interacting with a site, his session was active and everything was going smooth.But how does our player ("Server" , here) come to know that a user has

Can a user's session and their security ticket expire at different times?


Hi there,

If a user's security ticket and session state are configured to expire after twenty minutes, is it possible that one could go before the other? So for example, a user could have access to a protected web page but their sessions has been lost?

Cheers, WT.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.
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