I have an asp.net website in which users can submit reports. Another tester and I tested this page at the same time and when I went to review the information I submitted, it displayed information that I didn't submit. It displayed the info submitted from
the other user.
I use session variables for these values. I don't understand how this happened?
What can I do so each user can individually submit their information without overlapping some one else's information? The plan is for multiple users to be able to use this page to submit their weekly layer reports.
The first example of code is how I add the session variables from the textboxes.
If Session("BarnNo") = Nothing Then
'add session variables
Session.Add("FName", FNameTextbox.Text)
Session.Add("LName", LNameTextbox.Text)
Session.Add("WkEnd", Calendar1.SelectedDate.ToShortDateString())
Session.Add("DisplayDate", Calendar1.SelectedDate.ToLongDateString)
Session.Add("BarnNo", BarnNumberTextbox.Text)
Session.Add("FlockNo", FlockNoTextbox.Text)
Session.Add("HensSW", Hens)
Session.Add("WkMort", WkM)
Session.Add("SunEggs", Su)
Session.Add("MonEggs", Mo)
Session.Add("TueEggs", Tu)
Session.Add("WedEggs", We)
Session.Add("ThrEggs", Th)
Session.Add("FriEggs", Fr)
Session.Add("SatEggs", Sa)
Session.Add("TtlEggs", TtlEggCount)
If FeedDateTextbox.Text <> "" Or FeedFormTextbox.Text <> "" Or FeedQtyTextbox.Text <> "" Then
Session.Add("FeedDate", FeedDateTextbox.Text)
Session.Add("FeedForm", FeedFormTextbox.Text)
Session.Add("FeedQty", FQ)
End If
If FeedDateBTextbox.Text <> "" Or FeedFormBTextbox.Text <> "" Or FeedQtyBTextbox.Text <> "" Then
Session.Add("FeedDateB", FeedDateBTextbox.Text)
Session.Add("FeedFormB", FeedFormBTextbox.Text)
Session.Add("FeedQtyB", FQB)
End If
If FeedDateCTextbox.Text <> "" Or FeedFormCTextbox.Text <> "" Or FeedQtyCTextbox.Text <> "" Then
Session.Add("FeedDateC", FeedDateCTextbox.Text)
Session.Add("FeedFormC", FeedFormCTextbox.Text)
Session.Add("FeedQtyC", FQC)
End If
If FeedDateDTextbox.Text <> "" Or FeedFormDTextbox.Text <> "" Or FeedQtyDTextbox.Text <> "" Then
Session.Add("FeedDateD", FeedDateDTextbox.Text)
Session.Add("FeedFormD", FeedFormDTextbox.Text)
Session.Add("FeedQtyD", FQD)
End If
If FeedDateETextbox.Text <> "" Or FeedFormETextbox.Text <> "" Or FeedQtyETextbox.Text <> "" Then
Session.Add("FeedDateE", FeedDateETextbox.Text)
Session.Add("FeedFormE", FeedFormETextbox.Text)
Session.Add("FeedQtyE", FQE)
End If
If FeedDateFTextbox.Text <> "" Or FeedFormFTextbox.Text <> "" Or FeedQtyFTextbox.Text <> "" Then
Session.Add("FeedDateF", FeedDateFTextbox.Text)
Session.Add("FeedFormF", FeedFormFTextbox.Text)
Session.Add("FeedQtyF", FQF)
End If
If FeedDateGTextbox.Text <> "" Or FeedFormGTextbox.Text <> "" Or FeedQtyGTextbox.Text <> "" Then
Session.Add("FeedDateG", FeedDateGTextbox.Text)
Session.Add("FeedFormG", FeedFormGTextbox.Text)
Session.Add("FeedQtyG", FQG)
End If
Session.Add("SFIn", SFIn)
Session.Add("Avt", Avt)
If CND <> 0.0 Then
Session.Add("CND", CND)
Else
Session.Add("CNI", CNI)
End If
Session.Add("CCI", CCI)
Session.Add("wgw", wgw)
Session.Add("Comments", CommentsTextbox.Text)
End If
The second one is how I display them in labels on a confirmation page.
'1st project
BarnNumberLabel.Text = Session("BarnNo").ToString
FlockNoLabel.Text = Session("FlockNo").ToString
HensLabel.Text = Session("HensSW").ToString
WkMortLabel.Text = Session("WkMort").ToString
SunEggsLabel.Text = Session("SunEggs").ToString
MonEggsLabel.Text = Session("MonEggs").ToString
TueEggsLabel.Text = Session("TueEggs").ToString
WedEggsLabel.Text = Session("WedEggs").ToString
ThrEggsLabel.Text = Session("ThrEggs").ToString
FriEggsLabel.Text = Session("FriEggs").ToString
SatEggsLabel.Text = Session("SatEggs").ToString
TtlEggsLabel.Text = Session("TtlEggs").ToString
FeedDateLabel.Text = Session("FeedDate").ToString
FeedFormLabel.Text = Session("FeedForm").ToString
FeedQtyLabel.Text = Session("FeedQty").ToString
If Session("FeedDateB") <> Nothing Or Session("FeedFormB") <> Nothing Or Session("FeedQtyB") <> 0 Or Session("FeedQtyB") <> 0.0 Then
FDB.Visible = True
space.Visible = True
FeedDateBLabel.Text = Session("FeedDateB").ToString
FeedFormBLabel.Text = Session("FeedFormB").ToString
FeedQtyBLabel.Text = Session("FeedQtyB").ToString
spaceB.Visible = True
End If
If Session("FeedDateC") <> Nothing Or Session("FeedFormC") <> Nothing Or Session("FeedQtyC") <> 0 Or Session("FeedQtyC") <> 0.0 Then
FDC.Visible = True
FeedDateCLabel.Text = Session("FeedDateC").ToString
FeedFormCLabel.Text = Session("FeedFormC").ToString
FeedQtyCLabel.Text = Session("FeedQtyC").ToString
spaceC.Visible = True
End If
If Session("FeedDateD") <> Nothing Or Session("FeedFormD") <> Nothing Or Session("FeedQtyD") <> 0 Or Session("FeedQtyD") <> 0.0 Then
FDD.Visible = True
FeedDateDLabel.Text = Session("FeedDateD").ToString
FeedFormDLabel.Text = Session("FeedFormD").ToString
FeedQtyDLabel.Text = Session("FeedQtyD").ToString
spaceD.Visible = True
End If
If Session("FeedDateE") <> Nothing Or Session("FeedFormE") <> Nothing Or Session("FeedQtyE") <> 0 Or Session("FeedQtyE") <> 0.0 Then
FDE.Visible = True
FeedDateELabel.Text = Session("FeedDateE").ToString
FeedFormELabel.Text = Session("FeedFormE").ToString
FeedQtyELabel.Text = Session("FeedQtyE").ToString
spaceE.Visible = True
End If
If Session("FeedDateF") <> Nothing Or Session("FeedFormF") <> Nothing Or Session("FeedQtyF") <> 0 Or Session("FeedQtyF") <> 0.0 Then
FDF.Visible = True
FeedDateFLabel.Text = Session("FeedDateF").ToString
FeedFormFLabel.Text = Session("FeedFormF").ToString
FeedQtyFLabel.Text = Session("FeedQtyF").ToString
spaceF.Visible = True
End If
If Session("FeedDateG") <> Nothing Or Session("FeedFormG") <> Nothing Or Session("FeedQtyG") <> 0 Or Session("FeedQtyG") <> 0.0 Then
FDG.Visible = True
FeedDateGLabel.Text = Session("FeedDateG").ToString
FeedFormGLabel.Text = Session("FeedFormG").ToString
FeedQtyGLabel.Text = Session("FeedQtyG").ToString
End If
SatEndFdInvLabel.Text = Session("SFIn").ToString
AvgTempLabel.Text = Session("Avt").ToString
If Session("CND") <> 0.0 Then
CaseNoLabel.Text = Session("CND").ToString
ElseIf Session("CNI") <> 0 Then
CaseNoLabel.Text = Session("CNI").ToString
Else
CaseNoLabel.Visible = False
End If
CaseCoolLabel.Text = Session("CCI").ToString
WtrGalWkLabel.Text = Session("wgw").ToString
CommentsLabel.Text = Session("Comments").ToString
End If
Session values are stored based on the users login . I mean different user will have their own session values. there will be no overlapping in this case.
Thanks,
Hitesh Kumar Vyas S.
"Nobody can do everything, but everyone can do something."
Session variables are not overlapped with others, Whenever a user click on the button will start the new session only. for example test your application with 2 different browsers. you will get the clear idea.
Session variables are not overlapped with others, Whenever a user click on the button will start the new session only. for example test your application with 2 different browsers. you will get the clear idea.
I tested my page with 2 different tabs in the same browser. I submitted 1 project in each tab. When I reviewed the projects on both tabs, both pages displayed 2 projects when it should've displayed only 1 project per page.
If it's not the session variables causing this problem, then what is it? The plan is for multiple users to use this website.
I tested my page with 2 different tabs in the same browser. I submitted 1 project in each tab. When I reviewed the projects on both tabs, both pages displayed 2 projects when it should've displayed only 1 project per page.
If it's not the session variables causing this problem, then what is it? The plan is for multiple users to use this website.
ypu exlplain that you have open 2 different tabs but same browser than it is possible that one session variable overlap with others.In the practical way multipal users are not open in same browser you have to open in different browser.
for example you have open your yahoo mail with one id so you can open other yhaoo id in the same browser where your first id is run.....
Thanks & Regards
Vipul Donga
Mark it as an answer, if it helped
if (MyAnswer)
MarkAsAnswer();
else
Repsonse.Write("correct me where i am wrong");
I tested my page with 2 different tabs in the same browser. I submitted 1 project in each tab. When I reviewed the projects on both tabs, both pages displayed 2 projects when it should've displayed only 1 project per page.
If it's not the session variables causing this problem, then what is it? The plan is for multiple users to use this website.
I told to Test your application on two different browsers, not on tabs. If you have used the tabs session will get overlapped. Yeah your plan is right, but multiple users will never use same browser on same machine.
candyA22
Member
75 Points
148 Posts
Session variables are accessible to multiple users?
Oct 08, 2010 07:18 PM|LINK
I have an asp.net website in which users can submit reports. Another tester and I tested this page at the same time and when I went to review the information I submitted, it displayed information that I didn't submit. It displayed the info submitted from the other user.
I use session variables for these values. I don't understand how this happened?
What can I do so each user can individually submit their information without overlapping some one else's information? The plan is for multiple users to be able to use this page to submit their weekly layer reports.
The first example of code is how I add the session variables from the textboxes.
If Session("BarnNo") = Nothing Then 'add session variables Session.Add("FName", FNameTextbox.Text) Session.Add("LName", LNameTextbox.Text) Session.Add("WkEnd", Calendar1.SelectedDate.ToShortDateString()) Session.Add("DisplayDate", Calendar1.SelectedDate.ToLongDateString) Session.Add("BarnNo", BarnNumberTextbox.Text) Session.Add("FlockNo", FlockNoTextbox.Text) Session.Add("HensSW", Hens) Session.Add("WkMort", WkM) Session.Add("SunEggs", Su) Session.Add("MonEggs", Mo) Session.Add("TueEggs", Tu) Session.Add("WedEggs", We) Session.Add("ThrEggs", Th) Session.Add("FriEggs", Fr) Session.Add("SatEggs", Sa) Session.Add("TtlEggs", TtlEggCount) If FeedDateTextbox.Text <> "" Or FeedFormTextbox.Text <> "" Or FeedQtyTextbox.Text <> "" Then Session.Add("FeedDate", FeedDateTextbox.Text) Session.Add("FeedForm", FeedFormTextbox.Text) Session.Add("FeedQty", FQ) End If If FeedDateBTextbox.Text <> "" Or FeedFormBTextbox.Text <> "" Or FeedQtyBTextbox.Text <> "" Then Session.Add("FeedDateB", FeedDateBTextbox.Text) Session.Add("FeedFormB", FeedFormBTextbox.Text) Session.Add("FeedQtyB", FQB) End If If FeedDateCTextbox.Text <> "" Or FeedFormCTextbox.Text <> "" Or FeedQtyCTextbox.Text <> "" Then Session.Add("FeedDateC", FeedDateCTextbox.Text) Session.Add("FeedFormC", FeedFormCTextbox.Text) Session.Add("FeedQtyC", FQC) End If If FeedDateDTextbox.Text <> "" Or FeedFormDTextbox.Text <> "" Or FeedQtyDTextbox.Text <> "" Then Session.Add("FeedDateD", FeedDateDTextbox.Text) Session.Add("FeedFormD", FeedFormDTextbox.Text) Session.Add("FeedQtyD", FQD) End If If FeedDateETextbox.Text <> "" Or FeedFormETextbox.Text <> "" Or FeedQtyETextbox.Text <> "" Then Session.Add("FeedDateE", FeedDateETextbox.Text) Session.Add("FeedFormE", FeedFormETextbox.Text) Session.Add("FeedQtyE", FQE) End If If FeedDateFTextbox.Text <> "" Or FeedFormFTextbox.Text <> "" Or FeedQtyFTextbox.Text <> "" Then Session.Add("FeedDateF", FeedDateFTextbox.Text) Session.Add("FeedFormF", FeedFormFTextbox.Text) Session.Add("FeedQtyF", FQF) End If If FeedDateGTextbox.Text <> "" Or FeedFormGTextbox.Text <> "" Or FeedQtyGTextbox.Text <> "" Then Session.Add("FeedDateG", FeedDateGTextbox.Text) Session.Add("FeedFormG", FeedFormGTextbox.Text) Session.Add("FeedQtyG", FQG) End If Session.Add("SFIn", SFIn) Session.Add("Avt", Avt) If CND <> 0.0 Then Session.Add("CND", CND) Else Session.Add("CNI", CNI) End If Session.Add("CCI", CCI) Session.Add("wgw", wgw) Session.Add("Comments", CommentsTextbox.Text) End IfThe second one is how I display them in labels on a confirmation page.
'1st project BarnNumberLabel.Text = Session("BarnNo").ToString FlockNoLabel.Text = Session("FlockNo").ToString HensLabel.Text = Session("HensSW").ToString WkMortLabel.Text = Session("WkMort").ToString SunEggsLabel.Text = Session("SunEggs").ToString MonEggsLabel.Text = Session("MonEggs").ToString TueEggsLabel.Text = Session("TueEggs").ToString WedEggsLabel.Text = Session("WedEggs").ToString ThrEggsLabel.Text = Session("ThrEggs").ToString FriEggsLabel.Text = Session("FriEggs").ToString SatEggsLabel.Text = Session("SatEggs").ToString TtlEggsLabel.Text = Session("TtlEggs").ToString FeedDateLabel.Text = Session("FeedDate").ToString FeedFormLabel.Text = Session("FeedForm").ToString FeedQtyLabel.Text = Session("FeedQty").ToString If Session("FeedDateB") <> Nothing Or Session("FeedFormB") <> Nothing Or Session("FeedQtyB") <> 0 Or Session("FeedQtyB") <> 0.0 Then FDB.Visible = True space.Visible = True FeedDateBLabel.Text = Session("FeedDateB").ToString FeedFormBLabel.Text = Session("FeedFormB").ToString FeedQtyBLabel.Text = Session("FeedQtyB").ToString spaceB.Visible = True End If If Session("FeedDateC") <> Nothing Or Session("FeedFormC") <> Nothing Or Session("FeedQtyC") <> 0 Or Session("FeedQtyC") <> 0.0 Then FDC.Visible = True FeedDateCLabel.Text = Session("FeedDateC").ToString FeedFormCLabel.Text = Session("FeedFormC").ToString FeedQtyCLabel.Text = Session("FeedQtyC").ToString spaceC.Visible = True End If If Session("FeedDateD") <> Nothing Or Session("FeedFormD") <> Nothing Or Session("FeedQtyD") <> 0 Or Session("FeedQtyD") <> 0.0 Then FDD.Visible = True FeedDateDLabel.Text = Session("FeedDateD").ToString FeedFormDLabel.Text = Session("FeedFormD").ToString FeedQtyDLabel.Text = Session("FeedQtyD").ToString spaceD.Visible = True End If If Session("FeedDateE") <> Nothing Or Session("FeedFormE") <> Nothing Or Session("FeedQtyE") <> 0 Or Session("FeedQtyE") <> 0.0 Then FDE.Visible = True FeedDateELabel.Text = Session("FeedDateE").ToString FeedFormELabel.Text = Session("FeedFormE").ToString FeedQtyELabel.Text = Session("FeedQtyE").ToString spaceE.Visible = True End If If Session("FeedDateF") <> Nothing Or Session("FeedFormF") <> Nothing Or Session("FeedQtyF") <> 0 Or Session("FeedQtyF") <> 0.0 Then FDF.Visible = True FeedDateFLabel.Text = Session("FeedDateF").ToString FeedFormFLabel.Text = Session("FeedFormF").ToString FeedQtyFLabel.Text = Session("FeedQtyF").ToString spaceF.Visible = True End If If Session("FeedDateG") <> Nothing Or Session("FeedFormG") <> Nothing Or Session("FeedQtyG") <> 0 Or Session("FeedQtyG") <> 0.0 Then FDG.Visible = True FeedDateGLabel.Text = Session("FeedDateG").ToString FeedFormGLabel.Text = Session("FeedFormG").ToString FeedQtyGLabel.Text = Session("FeedQtyG").ToString End If SatEndFdInvLabel.Text = Session("SFIn").ToString AvgTempLabel.Text = Session("Avt").ToString If Session("CND") <> 0.0 Then CaseNoLabel.Text = Session("CND").ToString ElseIf Session("CNI") <> 0 Then CaseNoLabel.Text = Session("CNI").ToString Else CaseNoLabel.Visible = False End If CaseCoolLabel.Text = Session("CCI").ToString WtrGalWkLabel.Text = Session("wgw").ToString CommentsLabel.Text = Session("Comments").ToString End Ifvipuldonga
Contributor
3655 Points
671 Posts
Re: Session variables are accessible to multiple users?
Oct 09, 2010 05:35 AM|LINK
Hi,
can you please tell me what is youe session state?
It is inproc or anything else
Vipul Donga
Mark it as an answer, if it helped
if (MyAnswer)
MarkAsAnswer();
else
Repsonse.Write("correct me where i am wrong");
candyA22
Member
75 Points
148 Posts
Re: Session variables are accessible to multiple users?
Oct 09, 2010 05:47 PM|LINK
I'm not sure what you're asking. I add these session variables whenever the user clicks an "Add" button.
candyA22
Member
75 Points
148 Posts
Re: Session variables are accessible to multiple users?
Oct 11, 2010 12:20 PM|LINK
Can anyone else give me a possible explanation to this problem?
hitesh s
Participant
1268 Points
303 Posts
Re: Session variables are accessible to multiple users?
Oct 11, 2010 12:26 PM|LINK
Hi,
Session values are stored based on the users login . I mean different user will have their own session values. there will be no overlapping in this case.
Hitesh Kumar Vyas S.
"Nobody can do everything, but everyone can do something."
candyA22
Member
75 Points
148 Posts
Re: Session variables are accessible to multiple users?
Oct 11, 2010 12:48 PM|LINK
I'm not using a database of any kind so the user's not "logging" in to anything.
g_mani
Participant
1501 Points
422 Posts
Re: Session variables are accessible to multiple users?
Oct 11, 2010 01:01 PM|LINK
Session variables are not overlapped with others, Whenever a user click on the button will start the new session only. for example test your application with 2 different browsers. you will get the clear idea.
Please Mark as Answer If this is helpful.
candyA22
Member
75 Points
148 Posts
Re: Session variables are accessible to multiple users?
Oct 11, 2010 01:11 PM|LINK
I tested my page with 2 different tabs in the same browser. I submitted 1 project in each tab. When I reviewed the projects on both tabs, both pages displayed 2 projects when it should've displayed only 1 project per page.
If it's not the session variables causing this problem, then what is it? The plan is for multiple users to use this website.
vipuldonga
Contributor
3655 Points
671 Posts
Re: Session variables are accessible to multiple users?
Oct 11, 2010 01:19 PM|LINK
ypu exlplain that you have open 2 different tabs but same browser than it is possible that one session variable overlap with others.In the practical way multipal users are not open in same browser you have to open in different browser.
for example you have open your yahoo mail with one id so you can open other yhaoo id in the same browser where your first id is run.....
Vipul Donga
Mark it as an answer, if it helped
if (MyAnswer)
MarkAsAnswer();
else
Repsonse.Write("correct me where i am wrong");
g_mani
Participant
1501 Points
422 Posts
Re: Session variables are accessible to multiple users?
Oct 11, 2010 01:23 PM|LINK
I told to Test your application on two different browsers, not on tabs. If you have used the tabs session will get overlapped. Yeah your plan is right, but multiple users will never use same browser on same machine.
Please Mark as Answer If this is helpful.