Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Multi User At One Time

Multi User At One Time

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelpquestion
14 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H HatakeKaKaShi

    Hey Guys need ur advise ! I am currently developing a ASP.net. However i realise an issue is that When Person A log in to See Details of A1 record if Person B log in to see Details of B1. When A refresh it will see Details of B1 instead of A1. It Some how when B log in , the parameter of B overwrited A Any idea to resolve without using Session? Or Session is the only way to handle multi user at one time? if thats' the case all my variable need to be in Session? Please advise. Thanks a million bro

    KaKaShi HaTaKe

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #2

    It sounds like you're using static variables, otherwise there's no reason for this to happen. The record you're viewing, is usually stored on the URL, and the current user is stored in the session.

    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

    H 1 Reply Last reply
    0
    • C Christian Graus

      It sounds like you're using static variables, otherwise there's no reason for this to happen. The record you're viewing, is usually stored on the URL, and the current user is stored in the session.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      H Offline
      H Offline
      HatakeKaKaShi
      wrote on last edited by
      #3

      What about Global Variable? It will have the same effect as static? Will Object Oriented be a solution for Multi User at One Time ?

      KaKaShi HaTaKe

      C 1 Reply Last reply
      0
      • H HatakeKaKaShi

        What about Global Variable? It will have the same effect as static? Will Object Oriented be a solution for Multi User at One Time ?

        KaKaShi HaTaKe

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #4

        HatakeKaKaShi wrote:

        What about Global Variable?

        That would obviously be stupid.

        HatakeKaKaShi wrote:

        Will Object Oriented be a solution for Multi User at One Time ?

        Sounds to me like you are very, very lost. You should buy a basic ASP.NET book and read it. You've done things very wrong if you have the problem you're describing. Is this for homework, or for your job ?

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        H 1 Reply Last reply
        0
        • C Christian Graus

          HatakeKaKaShi wrote:

          What about Global Variable?

          That would obviously be stupid.

          HatakeKaKaShi wrote:

          Will Object Oriented be a solution for Multi User at One Time ?

          Sounds to me like you are very, very lost. You should buy a basic ASP.NET book and read it. You've done things very wrong if you have the problem you're describing. Is this for homework, or for your job ?

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          H Offline
          H Offline
          HatakeKaKaShi
          wrote on last edited by
          #5

          Yeah i am kind of lost and i know :( I am in deep trouble! Is for my job

          KaKaShi HaTaKe

          C 1 Reply Last reply
          0
          • H HatakeKaKaShi

            Yeah i am kind of lost and i know :( I am in deep trouble! Is for my job

            KaKaShi HaTaKe

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #6

            OK, so how did you get to have a job that you have no idea how to do ? How about you post some code so we can try to give some specific advice ?

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            H 1 Reply Last reply
            0
            • C Christian Graus

              OK, so how did you get to have a job that you have no idea how to do ? How about you post some code so we can try to give some specific advice ?

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              H Offline
              H Offline
              HatakeKaKaShi
              wrote on last edited by
              #7

              ok for example when i gotten the record id i will store as static string Record_ID = record id so i can use it in the page functions with out declaring or retrieve the record id again like Button_Click1 or any other funtion So if i am not mistaken this will only work on window app am i correct ? so now instead of storing as static i will have to use Session["RecordID"] =   record id or once again retieve the Retrieve the ID in every function i need? is that the way to do it?

              KaKaShi HaTaKe

              C 1 Reply Last reply
              0
              • H HatakeKaKaShi

                ok for example when i gotten the record id i will store as static string Record_ID = record id so i can use it in the page functions with out declaring or retrieve the record id again like Button_Click1 or any other funtion So if i am not mistaken this will only work on window app am i correct ? so now instead of storing as static i will have to use Session["RecordID"] =   record id or once again retieve the Retrieve the ID in every function i need? is that the way to do it?

                KaKaShi HaTaKe

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #8

                HatakeKaKaShi wrote:

                static string Record_ID = record id so i can use it in the page functions with out declaring or retrieve the record id again

                This is very wrong. 1 - static means it's visible to all users, that is what static does, windows or web 2 - either way, the variable does not persist between page loads anyhow, you need to use viewstate for that. session is to store values between pages, but it's better to put them on the URL if you can.

                HatakeKaKaShi wrote:

                or once again retieve the Retrieve the ID in every function i need?

                If you load the value in page load, it will remain the same for that page lifecycle. It just resets every time a page is requested. If your page shows a record, putting the id on the URL makes the most sense.

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                H N 2 Replies Last reply
                0
                • C Christian Graus

                  HatakeKaKaShi wrote:

                  static string Record_ID = record id so i can use it in the page functions with out declaring or retrieve the record id again

                  This is very wrong. 1 - static means it's visible to all users, that is what static does, windows or web 2 - either way, the variable does not persist between page loads anyhow, you need to use viewstate for that. session is to store values between pages, but it's better to put them on the URL if you can.

                  HatakeKaKaShi wrote:

                  or once again retieve the Retrieve the ID in every function i need?

                  If you load the value in page load, it will remain the same for that page lifecycle. It just resets every time a page is requested. If your page shows a record, putting the id on the URL makes the most sense.

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  H Offline
                  H Offline
                  HatakeKaKaShi
                  wrote on last edited by
                  #9

                  thanks bro But i need to store quite a number of variable if i put it all in the URL it will be very long So i think Session variable will do right?

                  KaKaShi HaTaKe

                  C 1 Reply Last reply
                  0
                  • H HatakeKaKaShi

                    thanks bro But i need to store quite a number of variable if i put it all in the URL it will be very long So i think Session variable will do right?

                    KaKaShi HaTaKe

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #10

                    You need to store a whole lot of variables for each user ? Why so many ? A query string can be reasonably long. Session is OK, but I try to avoid using it where I can. The thing about a querystring too is, it means the exact page can be bookmarked, as the right page will build itself from the URL.

                    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                    H 1 Reply Last reply
                    0
                    • C Christian Graus

                      You need to store a whole lot of variables for each user ? Why so many ? A query string can be reasonably long. Session is OK, but I try to avoid using it where I can. The thing about a querystring too is, it means the exact page can be bookmarked, as the right page will build itself from the URL.

                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                      H Offline
                      H Offline
                      HatakeKaKaShi
                      wrote on last edited by
                      #11

                      alright thanks bro i get when u mean. Yup i have a lot of variables some are being pass through to class function or next page. Bro another question is u dun mind. if i declare a variable with in a function let say protected void button1_Click(object sender, EventArgs e) {    string RecordID = Request.QueryString("RecordID");    Class class = new Class; //Class I Created    DataSet = class.ReturnDS(RecordID); //Function within the Class   } if there are mutiple user using is will the RecordID being Mix up again Showing person A Detail of B1 After both person trigger the same function?

                      KaKaShi HaTaKe

                      C 1 Reply Last reply
                      0
                      • H HatakeKaKaShi

                        alright thanks bro i get when u mean. Yup i have a lot of variables some are being pass through to class function or next page. Bro another question is u dun mind. if i declare a variable with in a function let say protected void button1_Click(object sender, EventArgs e) {    string RecordID = Request.QueryString("RecordID");    Class class = new Class; //Class I Created    DataSet = class.ReturnDS(RecordID); //Function within the Class   } if there are mutiple user using is will the RecordID being Mix up again Showing person A Detail of B1 After both person trigger the same function?

                        KaKaShi HaTaKe

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #12

                        HatakeKaKaShi wrote:

                        will the RecordID being Mix up again Showing person A Detail of B1 After both person trigger the same function?

                        No, each users pages get generated using different instances of this class, only statics will get mixed up between users.

                        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                        H 1 Reply Last reply
                        0
                        • C Christian Graus

                          HatakeKaKaShi wrote:

                          will the RecordID being Mix up again Showing person A Detail of B1 After both person trigger the same function?

                          No, each users pages get generated using different instances of this class, only statics will get mixed up between users.

                          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                          H Offline
                          H Offline
                          HatakeKaKaShi
                          wrote on last edited by
                          #13

                          Alright Thanks bro. Now i have a clear picture now. Thanks a lot man

                          KaKaShi HaTaKe

                          1 Reply Last reply
                          0
                          • C Christian Graus

                            HatakeKaKaShi wrote:

                            static string Record_ID = record id so i can use it in the page functions with out declaring or retrieve the record id again

                            This is very wrong. 1 - static means it's visible to all users, that is what static does, windows or web 2 - either way, the variable does not persist between page loads anyhow, you need to use viewstate for that. session is to store values between pages, but it's better to put them on the URL if you can.

                            HatakeKaKaShi wrote:

                            or once again retieve the Retrieve the ID in every function i need?

                            If you load the value in page load, it will remain the same for that page lifecycle. It just resets every time a page is requested. If your page shows a record, putting the id on the URL makes the most sense.

                            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                            N Offline
                            N Offline
                            N a v a n e e t h
                            wrote on last edited by
                            #14

                            Christian Graus wrote:

                            either way, the variable does not persist between page loads anyhow, you need to use viewstate for that. session is to store values between pages, but it's better to put them on the URL if you can.

                            Correct me if I am wrong, static variables will stay alive until the application domain unloads and will persist across post-backs.

                            Navaneeth How to use google | Ask smart questions

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups