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. Simple authentication without roles

Simple authentication without roles

Scheduled Pinned Locked Moved ASP.NET
securitytutorial
7 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 Offline
    H Offline
    Hemant Thaker
    wrote on last edited by
    #1

    Hi.. I m working on a web application where I have simple structure. I have root directory and a secure directory. root directory have pages which all users can request, and secure directory will be accessible to users who are authenticated. ( I dont need roles as i will have only one type of users).. can you tell me how to proceed for authentication.. thanks,

    By: Hemant Thaker

    R 1 Reply Last reply
    0
    • H Hemant Thaker

      Hi.. I m working on a web application where I have simple structure. I have root directory and a secure directory. root directory have pages which all users can request, and secure directory will be accessible to users who are authenticated. ( I dont need roles as i will have only one type of users).. can you tell me how to proceed for authentication.. thanks,

      By: Hemant Thaker

      R Offline
      R Offline
      R Giskard Reventlov
      wrote on last edited by
      #2

      There are several different ways to accomplish this; what have you tried so far? If your users have to log in you should be able to create some logic which tests for that and redirects or allows through as appropriate. How are you managing the users?

      me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

      H 1 Reply Last reply
      0
      • R R Giskard Reventlov

        There are several different ways to accomplish this; what have you tried so far? If your users have to log in you should be able to create some logic which tests for that and redirects or allows through as appropriate. How are you managing the users?

        me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

        H Offline
        H Offline
        Hemant Thaker
        wrote on last edited by
        #3

        Hi.. thanks, I am storing users in database. only username and pwd. Once user is logged in certain links will appear ( links for secured pages). so I want , only valid users can request these pages.. I simply want to stop someone directly using Urls in address bar for these secured pages.. thanks,

        By: Hemant Thaker

        R 1 Reply Last reply
        0
        • H Hemant Thaker

          Hi.. thanks, I am storing users in database. only username and pwd. Once user is logged in certain links will appear ( links for secured pages). so I want , only valid users can request these pages.. I simply want to stop someone directly using Urls in address bar for these secured pages.. thanks,

          By: Hemant Thaker

          R Offline
          R Offline
          R Giskard Reventlov
          wrote on last edited by
          #4

          One way would be to create an attribute that would test to see if the current user is logged in/valid. If not, then redirect to another page. You would create the attribute and then decorate the page class; see the tutorial or fond one more suitable. Attributes Tutorial[^] This is just one way and it may not be the best for you (or anyone, for that matter). Do some more research and see what else you can come up with on your own, try it and then come back when you get really stuck.

          me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

          H 1 Reply Last reply
          0
          • R R Giskard Reventlov

            One way would be to create an attribute that would test to see if the current user is logged in/valid. If not, then redirect to another page. You would create the attribute and then decorate the page class; see the tutorial or fond one more suitable. Attributes Tutorial[^] This is just one way and it may not be the best for you (or anyone, for that matter). Do some more research and see what else you can come up with on your own, try it and then come back when you get really stuck.

            me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

            H Offline
            H Offline
            Hemant Thaker
            wrote on last edited by
            #5

            Hi. I am storing username to a session["userid"] variable, once the user logged in. How about checking the session value on the page_load of all secured pages. and if dont find the value redirect to "custom_page" thanks

            By: Hemant Thaker

            R R 2 Replies Last reply
            0
            • H Hemant Thaker

              Hi. I am storing username to a session["userid"] variable, once the user logged in. How about checking the session value on the page_load of all secured pages. and if dont find the value redirect to "custom_page" thanks

              By: Hemant Thaker

              R Offline
              R Offline
              raju melveetilpurayil
              wrote on last edited by
              #6

              if (Session["userid"] != null)
              {
              //rediect to desired page
              }
              else
              {
              //rediect to custom page
              }

              Raju.M

              1 Reply Last reply
              0
              • H Hemant Thaker

                Hi. I am storing username to a session["userid"] variable, once the user logged in. How about checking the session value on the page_load of all secured pages. and if dont find the value redirect to "custom_page" thanks

                By: Hemant Thaker

                R Offline
                R Offline
                R Giskard Reventlov
                wrote on last edited by
                #7

                Let an attribute do that for you - that's what they are there for! Read the docs and i should get you started.

                me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

                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