Solved

W0rking with Seesions

Posted on 2008-10-18
7
195 Views
Last Modified: 2012-05-05
Hello,

I need a seesionto be created pnce User is logged in , and end his seesion once he log's out.
Please tell me is this right way to go further:

I'm getting null values in the transition pages, once the session variable is created.

Thanks.
Login.aspx:

Session["User"]= tbUser.text;
 

Transaction.aspx:

Session[user];
 

tbID.text = Session[user].ToString();

Open in new window

0
Comment
Question by:DevIndian
7 Comments
 
LVL 8

Expert Comment

by:vsudip
ID: 22749065
0
 
LVL 13

Expert Comment

by:sm394
ID: 22749144
change that
tbID.text = Session[user].ToString();
To
tbID.text = Session["User"].ToString();
0
 

Author Comment

by:DevIndian
ID: 22749178
No still ,I'm getting Null values
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 13

Assisted Solution

by:sm394
sm394 earned 100 total points
ID: 22749270
when you set session i assume there

Session["User"]= tbUser.text;

debug and check what value is being assigned
0
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 200 total points
ID: 22749286
on Login.aspx.cs

on button submit add this
Session["User"]= tbUser.text;

and on Transaction.aspx.cs

on page load event add this
tbID.text = Session["User"].ToString();

remove this Session[user];


0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 200 total points
ID: 22749403
Modifying the solution provided by BondInASP a little bit

on Login.aspx.cs
      on button submit add this
      Session["User"]= tbUser.text;

and on Transaction.aspx.cs
      on page load event first check whether the session is still valid or not
      check this before retriving user from session
      if (Session["User"] != null)
            tbID.text = Session["User"].ToString();

remove this Session[user] = null;
0
 

Author Comment

by:DevIndian
ID: 22750025
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
creating a flowchart from an algorithm 5 30
Loop not working 29 48
DateTimepicker 4 33
C# parent child form 5 19
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now