473,396 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Session is getting cleared on window close

Hi,
i m working on asp.net 2.0

I open a new window on a web page using hyperlink
through javascript

window.open("upload_image.aspx?vin=" + vin ,'codewindow','height=700,width=550,status=1');


after opening this new window when i close this new window to go parent window "Session is getting expired
Sothat im always getting redirected to login screen".

Please can you tell me what is the problem .???

Reply Soon

thanks in advance
Ajay Kumar
Apr 4 '07 #1
3 1176
hi,

Ajay

redirecting page will not solve this problem

use datatable and Datarow to preserve your (Application Session State) session values.

session["var"] = obj of datatable

and write code in pageload event
Apr 4 '07 #2
Try this How






using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ProtechITax.ProtechITax_BusinessLayer;
using ProtechITax.ProtechITax_Entities;


public partial class Fbt_fbtconference : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

//For percentage calculation
txtExp1Q1.Attributes.Add("onchange", "onChangeCalRow1();onChangeCalCol1();onChangeCalCo l5()");
txtExp1Q2.Attributes.Add("onchange", "onChangeCalRow1();onChangeCalCol2();onChangeCalCo l5()");
txtExp1Q3.Attributes.Add("onchange", "onChangeCalRow1();onChangeCalCol3();onChangeCalCo l5()");
txtExp1Q4.Attributes.Add("onchange", "onChangeCalRow1();onChangeCalCol4();onChangeCalCo l5()");


//For percentage calculation
txtExp3Q1.Attributes.Add("onchange", "onChangeCalRow3();onChangeCalCol1();onChangeCalCo l5()");
txtExp3Q2.Attributes.Add("onchange", "onChangeCalRow3();onChangeCalCol2();onChangeCalCo l5()");
txtExp3Q3.Attributes.Add("onchange", "onChangeCalRow3();onChangeCalCol3();onChangeCalCo l5()");
txtExp3Q4.Attributes.Add("onchange", "onChangeCalRow3();onChangeCalCol4();onChangeCalCo l5()");


//For percentage calculation
txtExp5Q1.Attributes.Add("onchange", "onChangeCalRow5();onChangeCalCol1();onChangeCalCo l5()");
txtExp5Q2.Attributes.Add("onchange", "onChangeCalRow5();onChangeCalCol2();onChangeCalCo l5()");
txtExp5Q3.Attributes.Add("onchange", "onChangeCalRow5();onChangeCalCol3();onChangeCalCo l5()");
txtExp5Q4.Attributes.Add("onchange", "onChangeCalRow5();onChangeCalCol4();onChangeCalCo l5()");

if ((!Page.IsPostBack) && Session["objfbtConferenceEntity"] != "" && Session["objfbtConferenceEntity"] != null)
{
fbtConferenceEntity objfbtConferenceEntity = new fbtConferenceEntity();
objfbtConferenceEntity = (fbtConferenceEntity)Session["objfbtConferenceEntity"];
txtExp1Q1.Text = Convert.ToString(objfbtConferenceEntity.q1exp1);
txtExp2Q1.Text = Convert.ToString(objfbtConferenceEntity.q1exp2);
txtExp3Q1.Text = Convert.ToString(objfbtConferenceEntity.q1exp3);
txtExp4Q1.Text = Convert.ToString(objfbtConferenceEntity.q1exp4);
txtExp5Q1.Text = Convert.ToString(objfbtConferenceEntity.q1exp5);

txtExp1Q2.Text = Convert.ToString(objfbtConferenceEntity.q2exp1);
txtExp2Q2.Text = Convert.ToString(objfbtConferenceEntity.q2exp2);
txtExp3Q2.Text = Convert.ToString(objfbtConferenceEntity.q2exp3);
txtExp4Q2.Text = Convert.ToString(objfbtConferenceEntity.q2exp4);
txtExp5Q2.Text = Convert.ToString(objfbtConferenceEntity.q2exp5);

txtExp1Q3.Text = Convert.ToString(objfbtConferenceEntity.q3exp1);
txtExp2Q3.Text = Convert.ToString(objfbtConferenceEntity.q3exp2);
txtExp3Q3.Text = Convert.ToString(objfbtConferenceEntity.q3exp3);
txtExp4Q3.Text = Convert.ToString(objfbtConferenceEntity.q3exp4);
txtExp5Q3.Text = Convert.ToString(objfbtConferenceEntity.q3exp5);

txtExp1Q4.Text = Convert.ToString(objfbtConferenceEntity.q4exp1);
txtExp2Q4.Text = Convert.ToString(objfbtConferenceEntity.q4exp2);
txtExp3Q4.Text = Convert.ToString(objfbtConferenceEntity.q4exp3);
txtExp4Q4.Text = Convert.ToString(objfbtConferenceEntity.q4exp4);
txtExp5Q4.Text = Convert.ToString(objfbtConferenceEntity.q4exp5);

lblTotExpQ1.Text = Convert.ToString(objfbtConferenceEntity.tot_expq1) ;
lblTotExpQ2.Text = Convert.ToString(objfbtConferenceEntity.tot_expq2) ;
lblTotExpQ3.Text = Convert.ToString(objfbtConferenceEntity.tot_expq3) ;
lblTotExpQ4.Text = Convert.ToString(objfbtConferenceEntity.tot_expq4) ;


}

}
protected void btnSave_Click(object sender, EventArgs e)
{
Session["objfbtConferenceEntity"] = "";
fbtConferenceEntity objfbtConferenceEntity = new fbtConferenceEntity();

if (txtExp1Q1.Text.Trim().Length == 0)
objfbtConferenceEntity.q1exp1 = 0;
else
objfbtConferenceEntity.q1exp1 = Convert.ToSingle(txtExp1Q1.Text.ToString().Trim()) ;

if (txtExp2Q1.Text.Trim().Length == 0)
objfbtConferenceEntity.q1exp2 = 0;
else
objfbtConferenceEntity.q1exp2 = Convert.ToSingle(txtExp2Q1.Text.ToString().Trim()) ;

if (txtExp3Q1.Text.Trim().Length == 0)
objfbtConferenceEntity.q1exp3 = 0;
else
objfbtConferenceEntity.q1exp3 = Convert.ToSingle(txtExp3Q1.Text.ToString().Trim()) ;

if (txtExp4Q1.Text.Trim().Length == 0)
objfbtConferenceEntity.q1exp4 = 0;
else
objfbtConferenceEntity.q1exp4 = Convert.ToSingle(txtExp4Q1.Text.ToString().Trim()) ;

if (txtExp5Q1.Text.Trim().Length == 0)
objfbtConferenceEntity.q1exp5 = 0;
else
objfbtConferenceEntity.q1exp5 = Convert.ToSingle(txtExp5Q1.Text.ToString().Trim()) ;

if (txtExp1Q2.Text.Trim().Length == 0)
objfbtConferenceEntity.q2exp1 = 0;
else
objfbtConferenceEntity.q2exp1 = Convert.ToSingle(txtExp1Q2.Text.ToString().Trim()) ;

if (txtExp2Q2.Text.Trim().Length == 0)
objfbtConferenceEntity.q2exp2 = 0;
else
objfbtConferenceEntity.q2exp2 = Convert.ToSingle(txtExp2Q2.Text.ToString().Trim()) ;

if (txtExp3Q2.Text.Trim().Length == 0)
objfbtConferenceEntity.q2exp3 = 0;
else
objfbtConferenceEntity.q2exp3 = Convert.ToSingle(txtExp3Q2.Text.ToString().Trim()) ;

if (txtExp4Q2.Text.Trim().Length == 0)
objfbtConferenceEntity.q2exp4 = 0;
else
objfbtConferenceEntity.q2exp4 = Convert.ToSingle(txtExp4Q2.Text.ToString().Trim()) ;

if (txtExp5Q2.Text.Trim().Length == 0)
objfbtConferenceEntity.q2exp5 = 0;
else
objfbtConferenceEntity.q2exp5 = Convert.ToSingle(txtExp5Q2.Text.ToString().Trim()) ;

if (txtExp1Q3.Text.Trim().Length == 0)
objfbtConferenceEntity.q3exp1 = 0;
else
objfbtConferenceEntity.q3exp1 = Convert.ToSingle(txtExp1Q3.Text.ToString().Trim()) ;

if (txtExp2Q3.Text.Trim().Length == 0)
objfbtConferenceEntity.q3exp2 = 0;
else
objfbtConferenceEntity.q3exp2 = Convert.ToSingle(txtExp2Q3.Text.ToString().Trim()) ;

if (txtExp3Q3.Text.Trim().Length == 0)
objfbtConferenceEntity.q3exp3 = 0;
else
objfbtConferenceEntity.q3exp3 = Convert.ToSingle(txtExp3Q3.Text.ToString().Trim()) ;

if (txtExp4Q3.Text.Trim().Length == 0)
objfbtConferenceEntity.q3exp4 = 0;
else
objfbtConferenceEntity.q3exp4 = Convert.ToSingle(txtExp4Q3.Text.ToString().Trim()) ;

if (txtExp5Q3.Text.Trim().Length == 0)
objfbtConferenceEntity.q3exp5 = 0;
else
objfbtConferenceEntity.q3exp5 = Convert.ToSingle(txtExp5Q3.Text.ToString().Trim()) ;

if (txtExp1Q4.Text.Trim().Length == 0)
objfbtConferenceEntity.q4exp1 = 0;
else
objfbtConferenceEntity.q4exp1 = Convert.ToSingle(txtExp1Q4.Text.ToString().Trim()) ;

if (txtExp2Q4.Text.Trim().Length == 0)
objfbtConferenceEntity.q4exp2 = 0;
else
objfbtConferenceEntity.q4exp2 = Convert.ToSingle(txtExp2Q4.Text.ToString().Trim()) ;

if (txtExp3Q4.Text.Trim().Length == 0)
objfbtConferenceEntity.q4exp3 = 0;
else
objfbtConferenceEntity.q4exp3 = Convert.ToSingle(txtExp3Q4.Text.ToString().Trim()) ;

if (txtExp4Q4.Text.Trim().Length == 0)
objfbtConferenceEntity.q4exp4 = 0;
else
objfbtConferenceEntity.q4exp4 = Convert.ToSingle(txtExp4Q4.Text.ToString().Trim()) ;

if (txtExp5Q4.Text.Trim().Length == 0)
objfbtConferenceEntity.q4exp5 = 0;
else
objfbtConferenceEntity.q4exp5 = Convert.ToSingle(txtExp5Q4.Text.ToString().Trim()) ;

if (lblTotExpQ1.Text.Trim().Length == 0)
objfbtConferenceEntity.tot_expq1 = 0;
else
objfbtConferenceEntity.tot_expq1 = Convert.ToSingle(lblTotExpQ1.Text);

if (lblTotExpQ2.Text.Trim().Length == 0)
objfbtConferenceEntity.tot_expq2 = 0;
else
objfbtConferenceEntity.tot_expq2 = Convert.ToSingle(lblTotExpQ2.Text);

if (lblTotExpQ3.Text.Trim().Length == 0)
objfbtConferenceEntity.tot_expq3 = 0;
else
objfbtConferenceEntity.tot_expq3 = Convert.ToSingle(lblTotExpQ3.Text);

if (lblTotExpQ4.Text.Trim().Length == 0)
objfbtConferenceEntity.tot_expq4 = 0;
else
objfbtConferenceEntity.tot_expq4 = Convert.ToSingle(lblTotExpQ4.Text);

Session["objfbtConferenceEntity"] = objfbtConferenceEntity;

BLLfbtConference objBLLfbtConference = new BLLfbtConference();

objBLLfbtConference.AddDLLfbtConference(objfbtConf erenceEntity);

Response.Write("<script language='javascript'>javascript:window.close();</script>");


}
}
Apr 4 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
This question is being moved to the .NET forum.

ADMIN
Apr 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk...
1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
3
by: JezB | last post by:
I want to clear some specific Session variables when the user closes a page. On my page I have a "return to ..." button which navigates back to the parent page from which it was invoked - under the...
6
by: Gonenc Ercan | last post by:
Hi, I ve ended up debugging a ASP.NET project (with about 380 files on the project .NET Framework 1.0 on IIS 5.0) which has a memory leak... The memory rises too fast. With about 25-30 active...
1
by: ad | last post by:
I am using the UserControls of VS2005 to verify user login, and I use Session to cache some user's data. Will the session data will be clean when user logout then login immediately?
3
by: Steph | last post by:
Hi, I am a programmer and I have a question about a ASP.NET peace of code. I have a program that has a session timeout of 2 minutes configured in Web.config file: <sessionState...
1
by: Chad | last post by:
When I visit a specific web page, Request.aspx, for some reason my session variables are cleared. I noticed that there is a "EnableSessionState" property on the document object that has three...
16
by: Jonathan Wood | last post by:
Greetings, I was wondering if anyone here has a good understaning of the Session object. I know there are options like the Session.Abandon method and the regenerateExpiredSessionId setting,...
1
by: Ramchandar | last post by:
Hi, I have an ASP.Net web application hosted in my local server with IIS 5.0 as web server. This worked fine with no issues. So I tried hosting the same into the server machine where I have IIS...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.