bob white

bob white

  • NA
  • 13
  • 82.7k

Enforce security inaspx. 3.5

Jan 5 2011 1:39 PM

// this piece of code will make the controls visible for 104 role only   
if (Global.enforceSecurity)
    if (!User.IsInRole("104"))
    {
      myDataGrid.EditButtonVisible = false;
      myDataGrid.AddButtonVisible = false;
      myDataGrid.DeleteButtonVisible = false;
    }
Vs
// this piece of code will make the controls visible for 104 role only
    if (User.IsInRole("104"))
    {
      myDataGrid.EditButtonVisible = true;
      myDataGrid.AddButtonVisible = true;
      myDataGrid.DeleteButtonVisible = true;
    }
The question, is there any difference in the implementation b/e both codes above? or if you have a better code than what I have presented. please share your code and experience
 
thanks
Bob
 

Answers (3)