Forms Authentication Roles

Discussion in 'ASP .Net' started by Brian Shannon, Aug 16, 2004.

  1. If you are using roles and assigning them from a SQL 2000 DB to the generic
    principal can you still use the web.config file to check authorization?

    All the articles I have read has the code behind
    If user.IsInRole("Admin")
    'Do whatever
    End IF

    Can't you use the web.config file if populating roles form the DB to check
    if you are authorized? It seems foolish if you have to use code behind. If
    you want to change roles then you have to recompile your project.

    Any feedback is appreciated
    Brian Shannon, Aug 16, 2004
    #1
    1. Advertising

  2. Brian Shannon

    Teemu Keiski Guest

    Hi,

    Yes, you can place authorization checks into web.config for roles which are
    populated from db to the current user's details.
    See this article for an example:
    http://www.codeproject.com/aspnet/formsroleauth.asp

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    http://blogs.aspadvice.com/joteke

    "Brian Shannon" <> wrote in message
    news:...
    > If you are using roles and assigning them from a SQL 2000 DB to the

    generic
    > principal can you still use the web.config file to check authorization?
    >
    > All the articles I have read has the code behind
    > If user.IsInRole("Admin")
    > 'Do whatever
    > End IF
    >
    > Can't you use the web.config file if populating roles form the DB to check
    > if you are authorized? It seems foolish if you have to use code behind.

    If
    > you want to change roles then you have to recompile your project.
    >
    > Any feedback is appreciated
    >
    >
    Teemu Keiski, Aug 16, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marty Underwood

    Forms Authentication +Active Directory +Roles

    Marty Underwood, Oct 29, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    698
    Marty Underwood
    Oct 30, 2003
  2. Showjumper
    Replies:
    2
    Views:
    295
    Showjumper
    Jan 26, 2004
  3. Stefan Kiryazov

    Roles in ASP.NET forms authentication

    Stefan Kiryazov, Jan 31, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,423
    Teemu Keiski
    Jan 31, 2004
  4. Eric
    Replies:
    2
    Views:
    1,406
    Tommy
    Feb 13, 2004
  5. Eric
    Replies:
    2
    Views:
    467
Loading...

Share This Page