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. authorization in asp.net using sql databse

authorization in asp.net using sql databse

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasesql-serversysadmin
8 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.
  • T Offline
    T Offline
    tejesh123
    wrote on last edited by
    #1

    Hi all, I am developing a project in asp.net. After the user login i want to provide authorization . The resources/access rights are stored in sql server which maps to group/user .please suggest how do i proceed.. Authorization is required at the menus and also it must able protect the user from directly opening the pages by typing in the url. Thxs in advance

    A 1 Reply Last reply
    0
    • T tejesh123

      Hi all, I am developing a project in asp.net. After the user login i want to provide authorization . The resources/access rights are stored in sql server which maps to group/user .please suggest how do i proceed.. Authorization is required at the menus and also it must able protect the user from directly opening the pages by typing in the url. Thxs in advance

      A Offline
      A Offline
      Anand Desai
      wrote on last edited by
      #2

      Hi,

      tejesh123 wrote:

      The resources/access rights are stored in sql server which maps to group/user

      Create session variables each for every right (like bit 1 for authorized and 0 for not). After login check for those in database and according to that set the session variables.

      tejesh123 wrote:

      Authorization is required at the menus

      Check for those variables while loading menu, if true then show link and otherwise.

      tejesh123 wrote:

      also it must able protect the user from directly opening the pages by typing in the url.

      At !PostBack, check if session variables have values or not and at not, redirect to Home Page. note: create all variables in one .cs page and render that whole page as Session (eg. SessionVariables sp = new SessionVariables(); sp = session["SessionVariables"]; where session["SessionVariables"] is created in previous page like session["SessionVariables"] = sp;) Hope this helps!!!

      Anand Desai Developer Atharva Infotech

      T 1 Reply Last reply
      0
      • A Anand Desai

        Hi,

        tejesh123 wrote:

        The resources/access rights are stored in sql server which maps to group/user

        Create session variables each for every right (like bit 1 for authorized and 0 for not). After login check for those in database and according to that set the session variables.

        tejesh123 wrote:

        Authorization is required at the menus

        Check for those variables while loading menu, if true then show link and otherwise.

        tejesh123 wrote:

        also it must able protect the user from directly opening the pages by typing in the url.

        At !PostBack, check if session variables have values or not and at not, redirect to Home Page. note: create all variables in one .cs page and render that whole page as Session (eg. SessionVariables sp = new SessionVariables(); sp = session["SessionVariables"]; where session["SessionVariables"] is created in previous page like session["SessionVariables"] = sp;) Hope this helps!!!

        Anand Desai Developer Atharva Infotech

        T Offline
        T Offline
        tejesh123
        wrote on last edited by
        #3

        Still confused.. After i retrive the resources from sql server in string array,i need to copy it in session then i need to check whether the resources matches the arrtribute tag for the page..if yes provide the access if no otherwise but how do i at menu level(Navigation) & if any alternate mechanism at the page level Please provide a sample code

        A 1 Reply Last reply
        0
        • T tejesh123

          Still confused.. After i retrive the resources from sql server in string array,i need to copy it in session then i need to check whether the resources matches the arrtribute tag for the page..if yes provide the access if no otherwise but how do i at menu level(Navigation) & if any alternate mechanism at the page level Please provide a sample code

          A Offline
          A Offline
          Anand Desai
          wrote on last edited by
          #4

          Instead using .NET server control for menu, use JavaScript for menu creation. It will ease checking an also provide better design with explicit css than in-built tamplets.

          Anand Desai Developer Atharva Infotech

          T 1 Reply Last reply
          0
          • A Anand Desai

            Instead using .NET server control for menu, use JavaScript for menu creation. It will ease checking an also provide better design with explicit css than in-built tamplets.

            Anand Desai Developer Atharva Infotech

            T Offline
            T Offline
            tejesh123
            wrote on last edited by
            #5

            Hi thx for ur quick reply. but i am still a newbie,Sample code can help me in resolving a problem Waiting for reply

            A 1 Reply Last reply
            0
            • T tejesh123

              Hi thx for ur quick reply. but i am still a newbie,Sample code can help me in resolving a problem Waiting for reply

              A Offline
              A Offline
              Abhijit Jana
              wrote on last edited by
              #6

              You can do it just simple way . Create a Default page that will display the Unauthorized User message. When you click on the link to open the page that time just simple check the roll of user, if the roles permit to access that page , navigate to that page other wise redirect to unauthorized access page. On unauthorized access page give a link to user back to the home page.

              OnAdminLinkClicked()
                {
                  if(Session["CurrentUserRole"].equals("Admin"))
                     {
                       Response.redirect("Admin.aspx");
                      }
                    else
                       {
                         Response.Redirect("Unauthorized.aspx)
                        }
                }
              

              Note: Given code is just a dummy example, not compiled and checked !!!

              cheers, Abhijit

              T 1 Reply Last reply
              0
              • A Abhijit Jana

                You can do it just simple way . Create a Default page that will display the Unauthorized User message. When you click on the link to open the page that time just simple check the roll of user, if the roles permit to access that page , navigate to that page other wise redirect to unauthorized access page. On unauthorized access page give a link to user back to the home page.

                OnAdminLinkClicked()
                  {
                    if(Session["CurrentUserRole"].equals("Admin"))
                       {
                         Response.redirect("Admin.aspx");
                        }
                      else
                         {
                           Response.Redirect("Unauthorized.aspx)
                          }
                  }
                

                Note: Given code is just a dummy example, not compiled and checked !!!

                cheers, Abhijit

                T Offline
                T Offline
                tejesh123
                wrote on last edited by
                #7

                thx for the reply Well there may be more than 100+ users and more than 100+ access right and which are defined at the group level and some special at personal level.. Is it going to be optimistic solution for my problem.. Any custom methods which can be used across all the pages on the website. Also please give a solution for menu security w/o using role based security provided by asp.net

                T 1 Reply Last reply
                0
                • T tejesh123

                  thx for the reply Well there may be more than 100+ users and more than 100+ access right and which are defined at the group level and some special at personal level.. Is it going to be optimistic solution for my problem.. Any custom methods which can be used across all the pages on the website. Also please give a solution for menu security w/o using role based security provided by asp.net

                  T Offline
                  T Offline
                  tejesh123
                  wrote on last edited by
                  #8

                  Hi all, I need to generate menubar .. The menu bar must generate the menus based on user privileges stored in the database.. Please Help its urgent

                  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