Forms based security

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

  1. #1

    Default Forms based security

    Hi there,
    In forms based security do I have to arrange pages into subdirectories
    in order to secure them? I want the public to access my home page and
    public content but want to restrict other content only to those for whom
    I've granted a userid. Seems like I must organize all the private content
    into one or more subdirectories. My problem is that I have some content
    that should be accessible to both and I hate to have to specify directory
    names when redirecting. Is there something that I can place in the load
    event of each page that checks to see if the user has been authenticated
    (checks for the cookie that would have been created)




    Charlie Dison Guest

  2. Similar Questions and Discussions

    1. Forms-Based Security below Application Level
      If I have a site where I want to use Forms-Based security but only on one or two SUB-directories of the Application root, I'm confused about how...
    2. Reg Role BAsed security..
      Hi All.. Can any body detail out the basic diff/advatages/disadvantage over acheiving the role based security and the same thing in case of...
    3. Forms-based Authentication
      HI I'm using Forms-based Authentication and trying out the example from the book: "ASP.NET Professional Secrets" after downloading the c# code...
    4. Security Based on NT Groups
      You can disable anonymous access to the site so the users have to log in (can be automatic in an intranet environment so users don't have to enter...
  3. #2

    Default RE: Forms based security

    Hi Charlie,

    To get the form authentication cookie, you may get the cookie name from:

    FormsAuthentication.FormsCookieName

    However, the cookie is encrypted, and we cannot get its actual value.

    Regarding the issue, since the content are accessible to both of
    Authenticated user and others, you can just leave the content public. Is
    this right?

    If you have private and public content on a same web form, you may consider
    following work around:

    When perform form authentication, you can add a cookie by yourself,
    indcating the user has been authenticated. And then, arrange pages based
    on this cookie value.

    Hope this help,

    Luke
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    [MSFT] Guest

  4. #3

    Default RE: Forms based security

    Dear Charlie,

    You don't need to arrange the authenticated pages inside a folder. You can specify the pages (say if they are minimum 5 pages etc.,) using location path. in that, you can also specify to allow the users, for whom you gave an userid. the following illustration shows the same:-

    <location path="ProtectedPage1.aspx">
    <system.web>
    <authorization>
    <allow users="UserId" />
    <deny users="*" />
    </authorization>
    </system.web>
    </location>

    the above, would allow users with the above userid (whatever you give) and will deny all other users (anonymous and logged in).

    however, in case you want to allow users with above userid as well as their own userid (logged in), change the <deny users="?" />. this will restrict only people
    who are not logged in.

    To check whether the user is logged in, use

    if(User.Identity.IsAuthenticated)
    {

    }

    to get the User's Id, use

    User.Identity.Name

    hope it helps.

    "Charlie Dison" wrote:
    > Hi there,
    > In forms based security do I have to arrange pages into subdirectories
    > in order to secure them? I want the public to access my home page and
    > public content but want to restrict other content only to those for whom
    > I've granted a userid. Seems like I must organize all the private content
    > into one or more subdirectories. My problem is that I have some content
    > that should be accessible to both and I hate to have to specify directory
    > names when redirecting. Is there something that I can place in the load
    > event of each page that checks to see if the user has been authenticated
    > (checks for the cookie that would have been created)
    >
    >
    >
    >
    >
    ranganh Guest

  5. #4

    Default Re: Forms based security

    Ok. that helps. Thanks
    "ranganh" <ranganh@discussions.microsoft.com> wrote in message
    news:985ABE3F-3E97-4557-93E8-1EDE5C89D06F@microsoft.com...
    > Dear Charlie,
    >
    > You don't need to arrange the authenticated pages inside a folder. You
    can specify the pages (say if they are minimum 5 pages etc.,) using location
    path. in that, you can also specify to allow the users, for whom you gave
    an userid. the following illustration shows the same:-
    >
    > <location path="ProtectedPage1.aspx">
    > <system.web>
    > <authorization>
    > <allow users="UserId" />
    > <deny users="*" />
    > </authorization>
    > </system.web>
    > </location>
    >
    > the above, would allow users with the above userid (whatever you give) and
    will deny all other users (anonymous and logged in).
    >
    > however, in case you want to allow users with above userid as well as
    their own userid (logged in), change the <deny users="?" />. this will
    restrict only people
    > who are not logged in.
    >
    > To check whether the user is logged in, use
    >
    > if(User.Identity.IsAuthenticated)
    > {
    >
    > }
    >
    > to get the User's Id, use
    >
    > User.Identity.Name
    >
    > hope it helps.
    >
    > "Charlie Dison" wrote:
    >
    > > Hi there,
    > > In forms based security do I have to arrange pages into
    subdirectories
    > > in order to secure them? I want the public to access my home page and
    > > public content but want to restrict other content only to those for whom
    > > I've granted a userid. Seems like I must organize all the private
    content
    > > into one or more subdirectories. My problem is that I have some content
    > > that should be accessible to both and I hate to have to specify
    directory
    > > names when redirecting. Is there something that I can place in the load
    > > event of each page that checks to see if the user has been authenticated
    > > (checks for the cookie that would have been created)
    > >
    > >
    > >
    > >
    > >
    >

    Charlie Dison Guest

  6. #5

    Default Re: Forms based security

    Ok. that helps. Thanks
    "[MSFT]" <lukezhan@online.microsoft.com> wrote in message
    news:X82wmA0VEHA.692@cpmsftngxa10.phx.gbl...
    > Hi Charlie,
    >
    > To get the form authentication cookie, you may get the cookie name from:
    >
    > FormsAuthentication.FormsCookieName
    >
    > However, the cookie is encrypted, and we cannot get its actual value.
    >
    > Regarding the issue, since the content are accessible to both of
    > Authenticated user and others, you can just leave the content public. Is
    > this right?
    >
    > If you have private and public content on a same web form, you may
    consider
    > following work around:
    >
    > When perform form authentication, you can add a cookie by yourself,
    > indcating the user has been authenticated. And then, arrange pages based
    > on this cookie value.
    >
    > Hope this help,
    >
    > Luke
    > Microsoft Online Support
    >
    > Get Secure! [url]www.microsoft.com/security[/url]
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    >

    Charlie Dison 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