Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Need advice on handling security

Reply
Thread Tools

Need advice on handling security

 
 
Bill Gower
Guest
Posts: n/a
 
      08-04-2007
I am validating the users of my web app against a user database in SQL
Server. I then store the user object in a session variable and pass it
around to the various forms. I have a field in the user object called Role
that either holds the value "BusinessAgent" or "Administrator". The role
type determines what forms the user can access and certain privileges in
forms. I have menus on a master page but I don't want to hide menu items
depending on the role type. I would like to in the page load of each form,
look at the role type and determine whether they have permission to the form
otherwise alert them to the fact that the form is for administrators only.
What is the best way to do this?

Bill


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-04-2007
On Aug 4, 7:46 am, "Bill Gower" <billgo...@charter.net> wrote:
> I am validating the users of my web app against a user database in SQL
> Server. I then store the user object in a session variable and pass it
> around to the various forms. I have a field in the user object called Role
> that either holds the value "BusinessAgent" or "Administrator". The role
> type determines what forms the user can access and certain privileges in
> forms. I have menus on a master page but I don't want to hide menu items
> depending on the role type. I would like to in the page load of each form,
> look at the role type and determine whether they have permission to the form
> otherwise alert them to the fact that the form is for administrators only.
> What is the best way to do this?
>


Hi Bill

you can check it in the code-behind

If Not User.IsInRole("Administrator") Then
Response.Write("Only administrators can see this form")
End If

you can set permissions in web.config

<location path="admin.aspx">
<system.web>
<authorization>
<allow roles="Administrator" />
<deny users="*" />
</authorization>
</system.web>
</location>

Hope this helps

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-04-2007
On Aug 4, 10:14 am, Alexey Smirnov <alexey.smir...@gmail.com> wrote:
> On Aug 4, 7:46 am, "Bill Gower" <billgo...@charter.net> wrote:
>
> > I am validating the users of my web app against a user database in SQL
> > Server. I then store the user object in a session variable and pass it
> > around to the various forms. I have a field in the user object called Role
> > that either holds the value "BusinessAgent" or "Administrator". The role
> > type determines what forms the user can access and certain privileges in
> > forms. I have menus on a master page but I don't want to hide menu items
> > depending on the role type. I would like to in the page load of each form,
> > look at the role type and determine whether they have permission to the form
> > otherwise alert them to the fact that the form is for administrators only.
> > What is the best way to do this?

>
> Hi Bill
>
> you can check it in the code-behind
>
> If Not User.IsInRole("Administrator") Then
> Response.Write("Only administrators can see this form")
> End If
>
> you can set permissions in web.config
>
> <location path="admin.aspx">
> <system.web>
> <authorization>
> <allow roles="Administrator" />
> <deny users="*" />
> </authorization>
> </system.web>
> </location>
>
> Hope this helps


P.S. I assume that you created a FormsAuthenticationTicket with roles
and assigned it the user

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
signal handling and (structured) exception handling Peter C++ 34 10-17-2009 10:03 AM
python list handling and Lisp list handling Mark Tarver Python 22 04-26-2009 09:36 PM
MCP>MCSA>MCSE + Security exam order advice need. =?Utf-8?B?TW9nbmFy?= MCSE 3 01-17-2006 12:04 PM
Need advice on security setup HG ASP .Net Security 0 02-24-2005 09:34 AM
IT-Security, Security, e-security COMSOLIT Messmer Computer Support 0 09-05-2003 08:34 AM



Advertisments