Need help improving authorization

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Need help improving authorization

    I don't have a response in framework.aspnet, may be this one is a more
    appropriate group.

    = = = = = = = = = = = = = = = = == = = = = = == = = = = = = = = = = = = = =
    = = =

    Each of my intranet page (windows authentication) needs to validate user's
    roles stored in the database. Currently, I retrieve the the
    User.Identity.Name property, then query the database for user's roles
    everytime a page is loaded, which is very inefficient.

    I think a more efficient approach would be to query the database only once
    for each user, the application_start event is probably the best place? Once
    this particular user's roles are retrieved, the roles can be concatenated as
    a delimied string and stored in cookie or a session variable. Then on each
    page load event, I just have to parse the roles string to apply
    authorization.

    I believe this scheme will work. But it seems more like a hack than a design
    pattern or a best practice. I'm seeking a .NET elegant solution. Please
    advise.

    TIA,
    Andi



    AndiV Guest

  2. Similar Questions and Discussions

    1. Improving User Experience
      Hi there I have a program which enables me to enter records into the database. What I would like to do is improve the system for the user. I...
    2. improving page tool
      it would be great if it is possible to drag and drop pages between open FH documents with page tool, great for building layouts. also a´book´...
    3. Improving embedded browser
      Dear sirs, I want to embed a browser inside my Director's movie. I have succeeded in embedding IE Active X control, but although it prefectly...
    4. Need help with improving my databasequery.
      I have the following MS Access table: Name -- Content Attributes -- Title Shortdesc Longdesc Synoniemen Using the next query I retrieve...
    5. ? improving on a Sony707
      I am reposting this as it seems to have got a bit lost. I am at present using aSony F707 and getting some good pics but a one off chance to...
  3. #2

    Default Re: Need help improving authorization

    The basic ideas are that you want to cache the role data, either in a cookie
    (which is what a lot of the forms auth samples show), Session or Cache.
    With a cookie, you need to make sure you encrypt or use an HMAC to ensure
    that the values are not tampered with.

    All three approaches work fine and have their good points and bad points as
    with any user state persistence requirement.

    Joe K.

    "Shaun" <Shaun@discussions.microsoft.com> wrote in message
    news:F571DD66-4B6A-4151-8E7F-4B273F0F1724@microsoft.com...
    > There are a few pages out there with methods for this, the one I used is
    [url]http://www.dotnet247.com/247reference/msgs/14/72098.aspx[/url] (you can find
    vb.net and c# versions, although changing the code is not difficult).
    >
    > Once you've used the code you find there you can check the roles using the
    IsInRole method.
    >
    > Hope this helps.
    >
    > --------------------------
    > Shaun Venus
    >
    > emailid: sunevnuahs
    > domain: hotmail.com
    > --------------------------
    >
    >
    > "AndiV" wrote:
    >
    > > I don't have a response in framework.aspnet, may be this one is a more
    > > appropriate group.
    > >
    > > = = = = = = = = = = = = = = = = == = = = = = == = = = = = = = = = = = =
    = =
    > > = = =
    > >
    > > Each of my intranet page (windows authentication) needs to validate
    user's
    > > roles stored in the database. Currently, I retrieve the the
    > > User.Identity.Name property, then query the database for user's roles
    > > everytime a page is loaded, which is very inefficient.
    > >
    > > I think a more efficient approach would be to query the database only
    once
    > > for each user, the application_start event is probably the best place?
    Once
    > > this particular user's roles are retrieved, the roles can be
    concatenated as
    > > a delimied string and stored in cookie or a session variable. Then on
    each
    > > page load event, I just have to parse the roles string to apply
    > > authorization.
    > >
    > > I believe this scheme will work. But it seems more like a hack than a
    design
    > > pattern or a best practice. I'm seeking a .NET elegant solution. Please
    > > advise.
    > >
    > > TIA,
    > > Andi
    > >
    > >
    > >
    > >

    Joe Kaplan \(MVP - ADSI\) Guest

  4. #3

    Default Re: Need help improving authorization

    Thanks for your help, Shaun and Joe.

    "AndiV" <andiv@yahoo.com> wrote in message
    news:u8F%236I3bEHA.4032@TK2MSFTNGP11.phx.gbl...
    > I don't have a response in framework.aspnet, may be this one is a more
    > appropriate group.
    >
    > = = = = = = = = = = = = = = = = == = = = = = == = = = = = = = = = = = = =
    =
    > = = =
    >
    > Each of my intranet page (windows authentication) needs to validate user's
    > roles stored in the database. Currently, I retrieve the the
    > User.Identity.Name property, then query the database for user's roles
    > everytime a page is loaded, which is very inefficient.
    >
    > I think a more efficient approach would be to query the database only once
    > for each user, the application_start event is probably the best place?
    Once
    > this particular user's roles are retrieved, the roles can be concatenated
    as
    > a delimied string and stored in cookie or a session variable. Then on each
    > page load event, I just have to parse the roles string to apply
    > authorization.
    >
    > I believe this scheme will work. But it seems more like a hack than a
    design
    > pattern or a best practice. I'm seeking a .NET elegant solution. Please
    > advise.
    >
    > TIA,
    > Andi
    >
    >
    >

    AndiV Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139