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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Authorization with config

Authorization with config

Scheduled Pinned Locked Moved ASP.NET
securitytutoriallounge
8 Posts 2 Posters 1 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.
  • T Offline
    T Offline
    Tzumer Edo
    wrote on last edited by
    #1

    I need a simple example of a general manager that can access all pages and a division manager allowed to access only his division's oriented page Tzumer

    E 1 Reply Last reply
    0
    • T Tzumer Edo

      I need a simple example of a general manager that can access all pages and a division manager allowed to access only his division's oriented page Tzumer

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      Is this homework?

      T 1 Reply Last reply
      0
      • E ednrgc

        Is this homework?

        T Offline
        T Offline
        Tzumer Edo
        wrote on last edited by
        #3

        I need this for a site i m to upgrade, there is the admin folder and an 'admin' user, now i need hierarchy for the admin so i need to limit/allow access to pages by the user the has logged in

        E 1 Reply Last reply
        0
        • T Tzumer Edo

          I need this for a site i m to upgrade, there is the admin folder and an 'admin' user, now i need hierarchy for the admin so i need to limit/allow access to pages by the user the has logged in

          E Offline
          E Offline
          ednrgc
          wrote on last edited by
          #4

          Check out MSDN for IsInRole: Something like this: modifiy the web.config as: And the Page_Load Code is: protected void Page_Load(object sender, EventArgs e) { if (Context.User.IsInRole("MyDomain\\WMS_ADMINISTRATORS")) { Label1.Text = Context.User.Identity.Name + " is part of ROLE"; } else { Label1.Text = Context.User.Identity.Name + " is NOT part of ROLE"; } }

          T 1 Reply Last reply
          0
          • E ednrgc

            Check out MSDN for IsInRole: Something like this: modifiy the web.config as: And the Page_Load Code is: protected void Page_Load(object sender, EventArgs e) { if (Context.User.IsInRole("MyDomain\\WMS_ADMINISTRATORS")) { Label1.Text = Context.User.Identity.Name + " is part of ROLE"; } else { Label1.Text = Context.User.Identity.Name + " is NOT part of ROLE"; } }

            T Offline
            T Offline
            Tzumer Edo
            wrote on last edited by
            #5

            Tnx, but what i meant was doing it without any code in the page, if i use code i can use the session and simply check it on each page, I have a login page that verifies credentials against the web.config I was wondering weather i can define, in the web.config, access to several pages to specific users or roles while different pages allow other users/roles access. Thus using only the web.config for that.

            E 1 Reply Last reply
            0
            • T Tzumer Edo

              Tnx, but what i meant was doing it without any code in the page, if i use code i can use the session and simply check it on each page, I have a login page that verifies credentials against the web.config I was wondering weather i can define, in the web.config, access to several pages to specific users or roles while different pages allow other users/roles access. Thus using only the web.config for that.

              E Offline
              E Offline
              ednrgc
              wrote on last edited by
              #6

              You have 2 options: 1) create a separate Web.config file in the directory to be secure. 2) add some more elements to the Web.config example:

              T 1 Reply Last reply
              0
              • E ednrgc

                You have 2 options: 1) create a separate Web.config file in the directory to be secure. 2) add some more elements to the Web.config example:

                T Offline
                T Offline
                Tzumer Edo
                wrote on last edited by
                #7

                But can i have different access to two pages in the same directory?

                E 1 Reply Last reply
                0
                • T Tzumer Edo

                  But can i have different access to two pages in the same directory?

                  E Offline
                  E Offline
                  ednrgc
                  wrote on last edited by
                  #8

                  Have you tried changing the location?

                  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