473,795 Members | 3,255 Online
Bytes | Software Development & Data Engineering Community
+ 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 1487
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(objec t sender, System.EventArg s e)

{

// Put user code to initialize the page here

if(! IsPostBack)

{

ePortalDataBase db=new ePortalDataBase ();

OleDbConnection con;

con=db.openconn ection();

con.Open ();

if(db.RunQuery( "Select aliasname,sitet itle from EL_PortalRegist ration where
siteaddress='si teadress' "))

{

while(db.result .Read())

{

lblUser.Text=db .result.GetValu e(0).ToString() ;

lblTitle.Text=d b.result.GetVal ue(1).ToString( ) ;

}

}

con.Close();

}

private void btnSignOut_Clic k(object sender, System.EventArg s 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.EventArg s e)

{

Session["EmailId"]=txtEmailId.Tex t;

Response.Redire ct("Eportal_Cou rses.aspx") ;

}

thanks and REgards

Yoshitha

"Masudur" <mu*****@gmail. comwrote in message
news:11******** **************@ h54g2000cwb.goo glegroups.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
2731
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. Problem: This always works fine on the localserver and through the IDE. But when the application is put onto a www website, the following occurs; - If you browse to the site using the IP address, session variables work fine
4
16066
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 properly with any. Help please? Sean
2
2359
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. Problem: This always works fine on the localserver and through the IDE. But when the application is put onto a www website, the following occurs; - If you browse to the site using the IP address, session variables work fine
1
1723
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 identity column on our sql server. I only set session("application") at the begiinning and it should stay the same as they fill out the application. But session("application") is not staying the same. When another user starts the application,...
5
3180
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 generate a random number and put it into an Array and store it in the Session variable and then when it runs the next time, generate another random number and display the entire Array contents, by pulling the information out of the Session. I'd...
9
2116
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
3049
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 variables get cleaned up? -- Jim Carlock Post replies to the group.
5
2210
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 POST variable into a session variable so I can use it in any other page I want to use it in? Apparently posted variables are only available in the Form page in
2
1440
by: KDawg44 | last post by:
On Aug 2, 6:38 pm, KDawg44 <KDaw...@gmail.comwrote: Nevermind. Got it working correctly. Thanks!
0
10214
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10001
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9042
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7540
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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 we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.