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. maintain such user on all web pages.

maintain such user on all web pages.

Scheduled Pinned Locked Moved ASP.NET
help
14 Posts 5 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.
  • M Offline
    M Offline
    Mr Wonderful
    wrote on last edited by
    #1

    Hi All, I involved in developing a web project, I do login page to new users can registered on my web page. the problem how I can user maintain in all pages he navigate to. any help plz. Regards

    V B P C 4 Replies Last reply
    0
    • M Mr Wonderful

      Hi All, I involved in developing a web project, I do login page to new users can registered on my web page. the problem how I can user maintain in all pages he navigate to. any help plz. Regards

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      I user Sessions. Basically, when a user logs in , i carry the Username, to Display a message like Welcome "James" and each and every page i check if the Session is new, that means i chech if the Session variable is empty if its new, the user must be redirected to the login page. Now when the User logs off , i abandon the Session. Hope it helps

      Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za

      M 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        I user Sessions. Basically, when a user logs in , i carry the Username, to Display a message like Welcome "James" and each and every page i check if the Session is new, that means i chech if the Session variable is empty if its new, the user must be redirected to the login page. Now when the User logs off , i abandon the Session. Hope it helps

        Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za

        M Offline
        M Offline
        Mr Wonderful
        wrote on last edited by
        #3

        thanks a lot that was very helpful. King Regards

        1 Reply Last reply
        0
        • M Mr Wonderful

          Hi All, I involved in developing a web project, I do login page to new users can registered on my web page. the problem how I can user maintain in all pages he navigate to. any help plz. Regards

          B Offline
          B Offline
          Brij
          wrote on last edited by
          #4

          Session variables are the best option to use it.Also you can use some database for logging the details of every user.

          Cheers!! Brij

          1 Reply Last reply
          0
          • M Mr Wonderful

            Hi All, I involved in developing a web project, I do login page to new users can registered on my web page. the problem how I can user maintain in all pages he navigate to. any help plz. Regards

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #5

            As the others have mentioned, use session variables. Do make sure when you are done with the user's session variable to delete it when finished. Otherwise, you will eventually (as this may take a very long time to have happen) run out of memory on the server where the values are kept.

            "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

            1 Reply Last reply
            0
            • M Mr Wonderful

              Hi All, I involved in developing a web project, I do login page to new users can registered on my web page. the problem how I can user maintain in all pages he navigate to. any help plz. Regards

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

              The one step no-one else mentioned, is to create a new base page, which redirects to the login page if the user is not already logged in. From there, it just works.

              Christian Graus Driven to the arms of OSX by Vista.

              P 1 Reply Last reply
              0
              • C Christian Graus

                The one step no-one else mentioned, is to create a new base page, which redirects to the login page if the user is not already logged in. From there, it just works.

                Christian Graus Driven to the arms of OSX by Vista.

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #7

                Good point.

                "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                C 1 Reply Last reply
                0
                • P Paul Conrad

                  Good point.

                  "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                  Would you believe I inherited a project that didn't bother to do this ? If you went to a URL inside the site directly, it would just work, or blow up on the basis of missing sessions variables ( not the login, all sorts of other stuff was being stored in the session and never checked when it was accessed ).

                  Christian Graus Driven to the arms of OSX by Vista.

                  P 1 Reply Last reply
                  0
                  • C Christian Graus

                    Would you believe I inherited a project that didn't bother to do this ? If you went to a URL inside the site directly, it would just work, or blow up on the basis of missing sessions variables ( not the login, all sorts of other stuff was being stored in the session and never checked when it was accessed ).

                    Christian Graus Driven to the arms of OSX by Vista.

                    P Offline
                    P Offline
                    Paul Conrad
                    wrote on last edited by
                    #9

                    Christian Graus wrote:

                    I inherited a project that didn't bother to do this

                    Oh boy, I bet that was loads of joy fixing that up.

                    "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                    C 1 Reply Last reply
                    0
                    • P Paul Conrad

                      Christian Graus wrote:

                      I inherited a project that didn't bother to do this

                      Oh boy, I bet that was loads of joy fixing that up.

                      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                      That was just one example, that whole site was a nightmare. The other big thing that blew my mind was that all session variables were strings, and all strings were typed in everywhere. I actually found code like this: if (Session["WeShouldDoStuffNow"] == "YES") when doing some searching proved that it was only ever set to Yes, or No. I obviously centralised all the 'WeShouldDoStuffNow' values to a class, so that there were never typos, but I gave up, I defined YES and NO rather than move to bools.

                      Christian Graus Driven to the arms of OSX by Vista.

                      P 1 Reply Last reply
                      0
                      • C Christian Graus

                        That was just one example, that whole site was a nightmare. The other big thing that blew my mind was that all session variables were strings, and all strings were typed in everywhere. I actually found code like this: if (Session["WeShouldDoStuffNow"] == "YES") when doing some searching proved that it was only ever set to Yes, or No. I obviously centralised all the 'WeShouldDoStuffNow' values to a class, so that there were never typos, but I gave up, I defined YES and NO rather than move to bools.

                        Christian Graus Driven to the arms of OSX by Vista.

                        P Offline
                        P Offline
                        Paul Conrad
                        wrote on last edited by
                        #11

                        Christian Graus wrote:

                        session variables were strings, and all strings were typed in everywhere

                        Those can be a problem. Session variables are going to be a part of my discussion this up coming Tuesday evening in my VB.NET class I teach. I try to emphasize the importance of doing something like:

                        Dim MyUser As String = "UserName"
                        If Session[MyUser] blah blah blah blah Then
                        ....
                        

                        is easier and safer to work with than having the variable name inside quotations. It is a point I try to get across, and usually get mixed mileage every semester.

                        "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                        C 1 Reply Last reply
                        0
                        • P Paul Conrad

                          Christian Graus wrote:

                          session variables were strings, and all strings were typed in everywhere

                          Those can be a problem. Session variables are going to be a part of my discussion this up coming Tuesday evening in my VB.NET class I teach. I try to emphasize the importance of doing something like:

                          Dim MyUser As String = "UserName"
                          If Session[MyUser] blah blah blah blah Then
                          ....
                          

                          is easier and safer to work with than having the variable name inside quotations. It is a point I try to get across, and usually get mixed mileage every semester.

                          "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                          Yeah, I would create a class that contains all the strings, and use it throughout the site. It's hard to believe that anyone would fail to understand how important that is, once it's explained to them.

                          Christian Graus Driven to the arms of OSX by Vista.

                          P 1 Reply Last reply
                          0
                          • C Christian Graus

                            Yeah, I would create a class that contains all the strings, and use it throughout the site. It's hard to believe that anyone would fail to understand how important that is, once it's explained to them.

                            Christian Graus Driven to the arms of OSX by Vista.

                            P Offline
                            P Offline
                            Paul Conrad
                            wrote on last edited by
                            #13

                            Christian Graus wrote:

                            would create a class that contains all the strings, and use it throughout the site.

                            Hmmmm, that sounds like a nice little final exam problem [evil grin]...

                            Christian Graus wrote:

                            It's hard to believe that anyone would fail to understand how important that is, once it's explained to them.

                            It happens from time to time, usually the student who is too busy IM'ing someone and not paying attention to the discussion. After they spend about two hours trying to debug the errors caused by the typos, it finally clicks.

                            "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                            C 1 Reply Last reply
                            0
                            • P Paul Conrad

                              Christian Graus wrote:

                              would create a class that contains all the strings, and use it throughout the site.

                              Hmmmm, that sounds like a nice little final exam problem [evil grin]...

                              Christian Graus wrote:

                              It's hard to believe that anyone would fail to understand how important that is, once it's explained to them.

                              It happens from time to time, usually the student who is too busy IM'ing someone and not paying attention to the discussion. After they spend about two hours trying to debug the errors caused by the typos, it finally clicks.

                              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                              *grin* there's no teacher like experience, I guess.

                              Christian Graus Driven to the arms of OSX by Vista.

                              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