473,473 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

session variable not working properly

Hi

i've some web user controls in one folder and web pages in some other
folder.

and i've included header web user control in all my web pages.
and in that user control wrote code to get the logged in user details to be
displayed in header.

In login user control, the logged in userid was stored in a session.

in one of web pages i'm retrieving the values based on the value stored in
session i set in login control.

and when i put cooment to the code in header control then the value is
maintained in session, if i remove comments then it is not storing any data
in session.

whats the problem with my code?

Thanks And Regards
Yoshitha.


Nov 27 '06 #1
2 1473
Dear Gurunadh,

Just Make sure you are not overriding the session variable in the
Header control.
A user controls page load event is raised after page's pageload event
is raised. so if you store or clear session in user control it will
override the value of the page's code.

But it will be helpful if you provide sample code in header control.

Thanks

Md. Masudur Rahman
www.kaz.com.bd
KAZ Software Ltd.
Software outsourcing made simple...

Gurunadh wrote:
Hi

i've some web user controls in one folder and web pages in some other
folder.

and i've included header web user control in all my web pages.
and in that user control wrote code to get the logged in user details to be
displayed in header.

In login user control, the logged in userid was stored in a session.

in one of web pages i'm retrieving the values based on the value stored in
session i set in login control.

and when i put cooment to the code in header control then the value is
maintained in session, if i remove comments then it is not storing any data
in session.

whats the problem with my code?

Thanks And Regards
Yoshitha.
Nov 27 '06 #2
Hi Rahman
private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

if(! IsPostBack)

{

ePortalDataBase db=new ePortalDataBase();

OleDbConnection con;

con=db.openconnection();

con.Open ();

if(db.RunQuery("Select aliasname,sitetitle from EL_PortalRegistration where
siteaddress='siteadress' "))

{

while(db.result.Read())

{

lblUser.Text=db.result.GetValue(0).ToString() ;

lblTitle.Text=db.result.GetValue(1).ToString() ;

}

}

con.Close();

}

private void btnSignOut_Click(object sender, System.EventArgs e)

{

Session.Abandon();

Server.Transfer("default.aspx");

}

this is the code i've written in header control

and this code i've writen in login control

private void btnLogin_Click(object sender, System.EventArgs e)

{

Session["EmailId"]=txtEmailId.Text;

Response.Redirect("Eportal_Courses.aspx") ;

}

thanks and REgards

Yoshitha

"Masudur" <mu*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Dear Gurunadh,

Just Make sure you are not overriding the session variable in the
Header control.
A user controls page load event is raised after page's pageload event
is raised. so if you store or clear session in user control it will
override the value of the page's code.

But it will be helpful if you provide sample code in header control.

Thanks

Md. Masudur Rahman
www.kaz.com.bd
KAZ Software Ltd.
Software outsourcing made simple...

Gurunadh wrote:
>Hi

i've some web user controls in one folder and web pages in some other
folder.

and i've included header web user control in all my web pages.
and in that user control wrote code to get the logged in user details to
be
displayed in header.

In login user control, the logged in userid was stored in a session.

in one of web pages i'm retrieving the values based on the value stored
in
session i set in login control.

and when i put cooment to the code in header control then the value is
maintained in session, if i remove comments then it is not storing any
data
in session.

whats the problem with my code?

Thanks And Regards
Yoshitha.

Nov 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: gfuller | last post by:
- We have 2 aspx pages in a .NET project. The first sets a session variable and has a button that when clicked performs a 'redirect' to the second page which then reads the session variable. ...
4
by: What-a-Tool | last post by:
I want to display a session variable as a textbox value: <input type="text" ...... value="<%=Session("myvar")%>"> I've tried several different variation of this and can't get it to display...
2
by: GFuller | last post by:
- We have 2 aspx pages in a .NET project. The first sets a session variable and has a button that when clicked performs a 'redirect' to the second page which then reads the session variable. ...
1
by: fizbang | last post by:
This should be impossible, but for some reason, people are not getting individual sessions. They start a session. I set the session("application") variable to the unique number generated by an...
5
by: TRB_NV | last post by:
I'm losing information from my Session when I change pages or start the same page over again. I simplified the code so the example is really clear. The sample code that follows is supposed to...
9
by: Schraalhans Keukenmeester | last post by:
I am stomped with the following problem: I have a script start.php and a second script proceed.php Relevant (and working) sections of the code: start.php <?PHP start_session();
3
by: Jim Carlock | last post by:
I have a problem where session cookies get left inside the temporary folder. Is this a common problem or is there perhaps something I've over looked - there a way to make sure the session...
5
by: Twayne | last post by:
Hi, If ever a newbie wants to know how much he has to learn yet, he only has to look here<g>!! ANYway: PHP 5.2.5; XP Pro SP2+, local Apache Server My actual question is: How do I get a...
2
by: KDawg44 | last post by:
On Aug 2, 6:38 pm, KDawg44 <KDaw...@gmail.comwrote: Nevermind. Got it working correctly. Thanks!
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,...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.