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. Manage role is this correct?

Manage role is this correct?

Scheduled Pinned Locked Moved ASP.NET
databasesecurityquestion
9 Posts 3 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.
  • A Offline
    A Offline
    amina89
    wrote on last edited by
    #1

    Hi, I failed to manage roles by code and web confg. so I used the code easily I have a table Security of my database (login,password,profil) and a login.aspx page and I need to open pages in each service to the people of this service .is this correct? can I combine the files into folders? I must change the file wb.config? my code: protected void Button7_Click(object sender, EventArgs e) { SqlConnection aCon = new SqlConnection(@"Data Source=.\SQLEXPRESS;UID=sa;Password=******;Initial Catalog=xxxxx"); aCon.Open(); String rqtr3 = " SELECT * FROM SECURITE WHERE LOGIN = '" + Textbox3.Text + "' AND PASSWORD='" + TextBox12.Text + "'"; SqlCommand cmr3 = new SqlCommand(rqtr3, aCon); SqlDataReader drr3 = cmr3.ExecuteReader(); while (drr3.Read() == true) { TextBox2.Text = drr3["PROFIL"].ToString(); if (TextBox2.Text == "service1") { Response.Redirect("default1.aspx"); } else { if (TextBox2.Text == "service2") { Response.Redirect("default2.aspx"); } else { if (TextBox2.Text == "service3") { Response.Redirect("default3.aspx"); } else......... } } } } Thanks.

    N L 2 Replies Last reply
    0
    • A amina89

      Hi, I failed to manage roles by code and web confg. so I used the code easily I have a table Security of my database (login,password,profil) and a login.aspx page and I need to open pages in each service to the people of this service .is this correct? can I combine the files into folders? I must change the file wb.config? my code: protected void Button7_Click(object sender, EventArgs e) { SqlConnection aCon = new SqlConnection(@"Data Source=.\SQLEXPRESS;UID=sa;Password=******;Initial Catalog=xxxxx"); aCon.Open(); String rqtr3 = " SELECT * FROM SECURITE WHERE LOGIN = '" + Textbox3.Text + "' AND PASSWORD='" + TextBox12.Text + "'"; SqlCommand cmr3 = new SqlCommand(rqtr3, aCon); SqlDataReader drr3 = cmr3.ExecuteReader(); while (drr3.Read() == true) { TextBox2.Text = drr3["PROFIL"].ToString(); if (TextBox2.Text == "service1") { Response.Redirect("default1.aspx"); } else { if (TextBox2.Text == "service2") { Response.Redirect("default2.aspx"); } else { if (TextBox2.Text == "service3") { Response.Redirect("default3.aspx"); } else......... } } } } Thanks.

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

      First, absolutely NEVER, EVER use unvalidated user input in your SQL statements. This is even more hanous because you are querying the security database. Lookup a term called 'SQL Injection attack'.


      I know the language. I've read a book. - _Madmatt

      A 1 Reply Last reply
      0
      • N Not Active

        First, absolutely NEVER, EVER use unvalidated user input in your SQL statements. This is even more hanous because you are querying the security database. Lookup a term called 'SQL Injection attack'.


        I know the language. I've read a book. - _Madmatt

        A Offline
        A Offline
        amina89
        wrote on last edited by
        #3

        Hi, even with an intranet? you advise me what? Thanks

        N 1 Reply Last reply
        0
        • A amina89

          Hi, even with an intranet? you advise me what? Thanks

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

          Even more so, most attacks occur from the inside


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • A amina89

            Hi, I failed to manage roles by code and web confg. so I used the code easily I have a table Security of my database (login,password,profil) and a login.aspx page and I need to open pages in each service to the people of this service .is this correct? can I combine the files into folders? I must change the file wb.config? my code: protected void Button7_Click(object sender, EventArgs e) { SqlConnection aCon = new SqlConnection(@"Data Source=.\SQLEXPRESS;UID=sa;Password=******;Initial Catalog=xxxxx"); aCon.Open(); String rqtr3 = " SELECT * FROM SECURITE WHERE LOGIN = '" + Textbox3.Text + "' AND PASSWORD='" + TextBox12.Text + "'"; SqlCommand cmr3 = new SqlCommand(rqtr3, aCon); SqlDataReader drr3 = cmr3.ExecuteReader(); while (drr3.Read() == true) { TextBox2.Text = drr3["PROFIL"].ToString(); if (TextBox2.Text == "service1") { Response.Redirect("default1.aspx"); } else { if (TextBox2.Text == "service2") { Response.Redirect("default2.aspx"); } else { if (TextBox2.Text == "service3") { Response.Redirect("default3.aspx"); } else......... } } } } Thanks.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            What you are trying to achieve is Role-based security using forms authentication. I found very good example for the same. Role-based Security with Forms Authentication[^] HTH

            Jinal Desai - LIVE Experience is mother of sage....

            N 1 Reply Last reply
            0
            • L Lost User

              What you are trying to achieve is Role-based security using forms authentication. I found very good example for the same. Role-based Security with Forms Authentication[^] HTH

              Jinal Desai - LIVE Experience is mother of sage....

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

              Role based security is also available out of the box with ASP.NET


              I know the language. I've read a book. - _Madmatt

              A 1 Reply Last reply
              0
              • N Not Active

                Role based security is also available out of the box with ASP.NET


                I know the language. I've read a book. - _Madmatt

                A Offline
                A Offline
                amina89
                wrote on last edited by
                #7

                Thanks a lot Mark Nischalke and Jinal Desai - LIVE, I used the link but when I login I have this message: Username / password incorrect. Please try again.(password and database connection are just) I think that I have a problem with the web config. Mark Nischalke I do not understand:Role based security is also available out of the box with ASP.NET. thanks

                modified on Monday, July 12, 2010 11:20 AM

                N 1 Reply Last reply
                0
                • A amina89

                  Thanks a lot Mark Nischalke and Jinal Desai - LIVE, I used the link but when I login I have this message: Username / password incorrect. Please try again.(password and database connection are just) I think that I have a problem with the web config. Mark Nischalke I do not understand:Role based security is also available out of the box with ASP.NET. thanks

                  modified on Monday, July 12, 2010 11:20 AM

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

                  How To: Use Role Manager in ASP.NET 2.0[^]


                  I know the language. I've read a book. - _Madmatt

                  A 1 Reply Last reply
                  0
                  • N Not Active

                    How To: Use Role Manager in ASP.NET 2.0[^]


                    I know the language. I've read a book. - _Madmatt

                    A Offline
                    A Offline
                    amina89
                    wrote on last edited by
                    #9

                    Thanks Mark Nischalke, I still have the same problem(with the previous link)and even using visual studio 2008 menu web site / asp.net configuration...Username / password incorrect. Please try again. i dont know if i have a problem in visual studio or what? thanks (sorry i dont speak english well)

                    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