Can not get the correct value back from session variable.

 When I assign multiple values to a session variables, I can only access the last one.

Session(CheckUser.FirstName) = tbFirstName.Text      (John)

Session(CheckUser.LastName) = tbLastName.Text     (Smith)

 

The result I get from this is always 'Smith'.

Session.Item(oLogin.FirstName)

What am I doing wrong?

 Thanks,

Sully1

0
Sully1
12/1/2008 6:37:12 PM
asp.net.state-management 8807 articles. 0 followers. Follow

3 Replies
876 Views

Similar Articles

[PageSpeed] 37

try like creating an arraylist and store it in session. check this link

http://forums.asp.net/t/1317594.aspx


"Never underestimate the power of stupid people in large groups"
0
deesh1531982
12/2/2008 4:31:38 AM

Sully1:
Session.Item(oLogin.FirstName)

Not sure what is "oLogin.FirstName" ?



My Blog


"Don't be afraid to be wrong; otherwise you'll never be right."
0
budugu
12/2/2008 4:48:55 AM

Hi,

In fact, you can use Session[oLogin.FirstName] to get first name directly.

If it does not work, please show your code, Any further question, please don’t hesitate to let me know.


Best Regards,
Bober Song
--------------------------------
Please remember to click “Mark as Answer” on the post that helps you
0
Bober
12/3/2008 6:21:30 AM
Reply:

Similar Artilces:

After a looong night managed to change Session mode from inProc to SQLServer but still can't get the session variables to be saved
Hi,  I ran my Shopping Cart project and somehow everything worked fine(while in inProc), session variables were saved fine. I made some changes to my project and since then keep getting null session variables, no matter what I do. It took me the whole night to figure out how to turn to SQLServer mode,  marked custom classes as 'Serializable' with [Serializable] before the class definition but everything's in vain. Getting the same damned 'nulls' instead of the saved objects. private void Page_Load(object sender, System.EventArgs e)         {...

How to get session variable value into a static variable
Hi, On page preinit i am adding few session variables. Now i want to retrive these session variable values into my static variables. protected void Page_PreInit(object sender, EventArgs e) {Session.Add("T", "Default"); Session.Add("T1", "Red"); Session.Add("T2", "Blue");   }   i have few static variables which shud contain these vaules.  public string TT; public string TT1; public string TextForeColor =sess = "#FFFFFF";   i want to get T value into TT ... T1 into TT1..and so on &n...

Declaring a scope variable in a Web Service can hold values as Session State does?
I declared a scope variable in my web service and it seems that is holding the value between sessions. There is anyway to configure the life time of this variable?  I putted a dispose method but I had to "overload". Thank you very much for clarify this to me.As Heinlein said "specialization is for insects" explore beyond the universe.  did you use Static on this variable? If you did that is why it's retaining it's value.The Killer Ninja Coding Monkeys thank those that mark helpful posts as answers.My Site | My Examples | My Blog Thank y...

How can I get a "variable value" from the "variable name"
Hi All, How can I get a "variable value" from the "variable name" ? For Example: ClassDefinition cd_def VariableDefinition vd_def cd_def = this.classdefinition For li_i = 1 To UpperBound (cd_def.VariableList) vd_def = cd_def.VariableList[li_i] MessageBox ("Variable Name: ", vd_def.name ) MessageBox ("Variable Value: ", "??????????") Next Thanks, Gustavo Which value do you expect to get? pbm_thisusuallydoesnothelp:-)) Philip Salgannik <Gustavo> wrote in message news:4069b28a.30f0.846930886@sybase.co...

State & Country validation. Problems getting back correct state.SelectedItem.Text
I am trying to validate a web form that accepts a users address. Among other fields there is one DropDownList for State/Province:<asp:Label ID="lblstate" AssociatedControlID="state" runat="server" Text="State/Province" /><asp:RequiredFieldValidator ID="state_required" runat="server" ControlToValidate="state" ErrorMessage="State/Province is required." Text="*" /> <asp:DropDownList ID="state" runat="server" />And one DropDownList for Country:<asp:Label ID="lblcountry" AssociatedControlID="country" runat="server" Text="Country" /><asp:RequiredFieldValidator ID="count...

session value not working, but hard coding value works, but session value writes to label correctly
I add a value to the session in the parent window:Session("value1") = value.text.trim()I have a button on a that page opening a popup window using javascript.In the popup window I get the value from the session:Protected Sub Page_Load......Dim ValueDesc As String = Session.Item("value1") Label1.Text = ValueDesc (This shows the correct value for ValueDesc)I then get the first 3 char of ValueDescDim SearchString As String = Left(ValueDesc, 3) Label2.Text = SearchString (This shows the correct value for SearchString)I then pass SearchString to a Protected Sub:BindtoGrid(Sear...

Session Variables (Get values)
Hi, I am storing some variables in Session, Double values, Integers and Strings.Sometimes these values can be null or empty (""). While retrieving these values from session I will declare a variable of its type. Let say for example I want to get a Double value from Session. Dim dblAmount as DoubledblAmount = Session("sessAmount") Here I am getting trouble when value is empty, its giving an errorConversion from string "" to type 'Double' is not valid. How to handle this kind of situations? Let me know your suggestion. Thanks   Hi. Before assigning the value, check if the session...

getting value of session variable
I'm trying to display the value of a session variable in a label. I know the session variable exists because in my page load event I redirect the user to a different page if it's value is null. I want to display it's value in a label to test some things, but I keep getting an error whenever I try.  Here is my code:   Label:<asp:Label ID="lblSessionTest" runat="server" Text="Label"></asp:Label>  How I'm trying to display it (in my page load event):  lblSessionTest.Text = Session("loggedIn"); &nbs...

Getting value out of session variable
 Hi,How to get the value of a session. It is storing the dataset value. I dont know how to transfer that to a variable.   private SearchDotnet.Searchs.UserSearch sSite;  if ((sSite == null))          {             sSite = Session["Site"];           }         }  The thing is sSite is  delcared as above. I need to unload the session variable to sSite. Have not found a...

Can't get a new Session Variable to pass into a method (used Session, TextField and QueryString)
Hi Everyone,  I have been battling with this for about 18 hours now and coudl use some help...  I have a form that inserts into a DB table and then calls a method that makes a query to another table to create a Dataset for insert into a third table. ( I haven't done the third table insert yet but first things first.) Step 1 works fine. Step two is the problem. When I call the method I pass in two variables to get  return it will only work if I call an OLD Session variable. The session vaiable i set in the onSelectedChange event won't pass into the parameters... I als...

How can I display a session value in a textbox on the next page or/and use this session variable in my where clause of a datasource control?
How can I displacy a session value in a textbox on the next page or/and use this session variable in my where clause of a datasource control?  Can someone tell me how I can display a session variable from one page to the other page's control?  I am wrinting a session value using this on my default.aspx page :  Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.ClickSession("myKey") = 1 Response.Redirect("page1.aspx") End Sub on page1.aspx: <asp:View ID="view1" runat="ser...

Hi....Can we Declare variables that can be accessed globally across a single session without using server and client state mgt?
Hi to all .net Techies........ i have got an issue regarding global access of variables across a single (and not all) session.....Is it possible that i can declare a variable that is globally accessible across a particular session without using state management techinique?? Since mine is a web application  so i can't use static variables since they will be accessible globally across all the sessions(i.e for all the users who r accessing our website at same time) and not for a particular session. I mean if i create a class n decalre a property in it......and on one web form i set its pro...

How can I get Server Variable value
Hello! IW 12.2, Delphi XE2, ISAPI. I need read some server variables (IIS), as ASP's Request.ServerVariables("Some_variable") function. How can I do it? I try use WebApplication.Request.*, but it contains only several from values. I need LOGON_USER variable. Thanks, Dmitry Ukolov. Hi Dmitry Use Request.GetFieldByName(const Name: AnsiString): AnsiString; virtual; For TISAPIRequest uses ECB.GetServerVariable, where ECB is the ISAPI PEXTENSION_CONTROL_BLOCK Cheers Plp Em 10-09-2012 13:52, Dmitry Ukolov escreveu: > Hello! > > IW 12.2, Delp...

How can I increment the value of a session variable?
As many of you probably already know, the following doesn't work: Session["NumGuesses"] = ++Session["NumGuesses"]; as it says, "Operator '++' cannot be applied to operand of type 'object'"Clay Shannon,author of historical works, novels, and art/poetryhttp://www.knowitallsports.com/booklinks.aspx ClayShannon:As many of you probably already know, the following doesn't work: Session["NumGuesses"] = ++Session["NumGuesses"]; as it says, "Operator '++' cannot be applied to operand of type 'object'...

Web resources about - Can not get the correct value back from session variable. - asp.net.state-management

Variable - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Westpac interest rate rise is one of many variable loan rate rises
WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Airbnb upgrades variable pricing tool for hosts
Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Commonwealth Bank raises variable home loan rates
Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

CBA lifts variable home loan rates to offset costs associated with stricter capital requirements
The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

Washington Square Signs Spielbergs, Choi Joins Variable and More
... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

YouTube v10.32 Tweaks Some Interface Elements And Includes Hints About Virtual Reality Content And Variable ...
Forget Update Wednesday! Monday is the new big day. Not only were we treated to the latest M preview release and the official Marshmallow name, ...

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

Cisco Debuts Open Pay Variable Pricing, Updates CCRE
Cisco Debuts Open Pay Variable Pricing, Updates CCRE Channel Partners Kris Snow, president of Cisco Capital, says the company's new Open Pay ...

Expert Reveals the Latest Variable Capacity Technology
Learn about gForce Ultra CRAC equipment, the latest variable capacity technology to lower energy usage and increase reliability.

Resources last updated: 12/15/2015 7:46:36 PM