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. Disallow user acess to certain web pages unless logged in

Disallow user acess to certain web pages unless logged in

Scheduled Pinned Locked Moved ASP.NET
comtutorial
5 Posts 4 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.
  • V Offline
    V Offline
    v1i9n6o7d
    wrote on last edited by
    #1

    Hi, In a web site I want to disallow users to give absolute addresses in the address bar for accessing web pages. Let me illustrate with an example. Suppose my website has three webpages login.aspx,a.aspx, and b.aspx I do not want the users to navigate to a.aspx or b.aspx by giving the following url in the address bar http://www.mywebsite.com/a.aspx or http://www.mywebsite.com/b.aspx Login.aspx is the startup page of the website. They should be able to access this web pages only if they have logged in. Regards Vinod

    C P N 3 Replies Last reply
    0
    • V v1i9n6o7d

      Hi, In a web site I want to disallow users to give absolute addresses in the address bar for accessing web pages. Let me illustrate with an example. Suppose my website has three webpages login.aspx,a.aspx, and b.aspx I do not want the users to navigate to a.aspx or b.aspx by giving the following url in the address bar http://www.mywebsite.com/a.aspx or http://www.mywebsite.com/b.aspx Login.aspx is the startup page of the website. They should be able to access this web pages only if they have logged in. Regards Vinod

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

      There are SO many articles online about this. Basically, the way to do it by hand is to derive all pages that require login from a base page that checks a session variable to see if the user is logged in. Set that variable when the user logs in, and clear it when they log out. Done.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      V 1 Reply Last reply
      0
      • V v1i9n6o7d

        Hi, In a web site I want to disallow users to give absolute addresses in the address bar for accessing web pages. Let me illustrate with an example. Suppose my website has three webpages login.aspx,a.aspx, and b.aspx I do not want the users to navigate to a.aspx or b.aspx by giving the following url in the address bar http://www.mywebsite.com/a.aspx or http://www.mywebsite.com/b.aspx Login.aspx is the startup page of the website. They should be able to access this web pages only if they have logged in. Regards Vinod

        P Offline
        P Offline
        pmarfleet
        wrote on last edited by
        #3

        You need to look into ASP.NET Forms Authentication

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        1 Reply Last reply
        0
        • C Christian Graus

          There are SO many articles online about this. Basically, the way to do it by hand is to derive all pages that require login from a base page that checks a session variable to see if the user is logged in. Set that variable when the user logs in, and clear it when they log out. Done.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          V Offline
          V Offline
          v1i9n6o7d
          wrote on last edited by
          #4

          Thanx Chris :)

          1 Reply Last reply
          0
          • V v1i9n6o7d

            Hi, In a web site I want to disallow users to give absolute addresses in the address bar for accessing web pages. Let me illustrate with an example. Suppose my website has three webpages login.aspx,a.aspx, and b.aspx I do not want the users to navigate to a.aspx or b.aspx by giving the following url in the address bar http://www.mywebsite.com/a.aspx or http://www.mywebsite.com/b.aspx Login.aspx is the startup page of the website. They should be able to access this web pages only if they have logged in. Regards Vinod

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            <location path="a.aspx">
            <system.web>
            <authorization>
            <deny users="*"/>
            </authorization>
            </system.web>
            </location>


            only two letters away from being an asset

            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