Authentication in ASP.NET: best practice?

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

  1. #1

    Default Authentication in ASP.NET: best practice?

    I'd like to poll for some best practices about ASP.NET application
    security.

    Here's what it's about:
    I wanna develop an ASP.NET web application with VS.NET 2003. This
    application consists of some pages which are available for anonymous
    users and some that are NOT available for anonymous users (i.e. need
    authentication).

    To achieve this I set the web.config <authentication>-tag to <forms
    ....> and <deny users="?"> in the <authorization>-tag. This will
    redirect every unkown user to my login-form. To allow anonymous users
    browse to the other pages (which don't need authentication) I made a
    second project. Here the <authorization>-tag in the web.config stated
    <allow users="*">

    But, since my application is not really big I thought this is too much
    work (i.e. creating two projects); since I only need authentication
    for half of my ASP.NET pages. Maybee there is another way. I was
    thinking of making a new login-form where I set an attribute in the
    session state. Then in every page which needs authentication, I check
    if this attribute is set in the page_load. If not so, redirect the
    user to the login-form. To logout the user can either close the
    browser of I redirect them to a form where the can sign-out (which
    will delete the session attribute).

    Please share your thoughts about this. Maybe their are even (!) better
    idea's.

    Kind regards,

    Jules Hoppenbrouwers

    < Don't reply by email. Use this forum instead.>
    Jules Hoppenbrouwers Guest

  2. Similar Questions and Discussions

    1. best practice / tips
      What are the best practices for setting up a 3d game? (stripping the programming for the most part) is it best to make one w3d with everything...
    2. Forms Authentication and requireSSL, what's the recommended best practice
      I have an ASP.NET 1.1 Web app and am now implementing SSL. It used forms authentication. Everything works fine but I get unexpected(by me) behavior...
    3. Best practice in postgres
      Hi All, I'm new to postgres, so I need your help. We are in the process of migrating from oracle to postgres. DB size is about 400gb. My...
    4. ASP (not Asp.Net) database best practice?
      Will the object variables of Connection, - Server.CreateObject("ADODB.Connection") Recordset - Server.CreateObject("ADODB.Recordset") and...
    5. WS-Security Best Practice?
      I'm new to Webservices, but nonetheless have taken the leap! I have a ws I'm writing that will be used in a subscription. Nothing huge or...
  3. #2

    Default RE: Authentication in ASP.NET: best practice?

    I don't believe that your web.config must be global to the project. Try
    creating a subdirectory for your project and put a second web.config in
    there. Some settings cannot be overridden and it doesn't make sense to put
    them in both locations, but the authentication and authorization stuff is
    ok I think.

    You will want the root to allow anonymous access, but then for any of the
    pages that are restricted and in your second folder, the web.config will
    notice that you marked that one as needing authentication and redicect to
    the login.aspx page you specified unless they are already logged in.

    I've done this before but don't have the project in front of me anymore to
    send you my config files, but give that a try.

    -----------

    This posting is provided "AS IS" with no warranties, and
    confers no rights.

    Please do not send e-mail directly to this alias. This
    alias is for newsgroup purposes only.

    Thanks
    Nick
    >I'd like to poll for some best practices about ASP.NET application
    >security.
    >
    >Here's what it's about:
    >I wanna develop an ASP.NET web application with VS.NET 2003. This
    >application consists of some pages which are available for anonymous
    >users and some that are NOT available for anonymous users (i.e. need
    >authentication).
    >
    >To achieve this I set the web.config <authentication>-tag to <forms
    >...> and <deny users="?"> in the <authorization>-tag. This will
    >redirect every unkown user to my login-form. To allow anonymous users
    >browse to the other pages (which don't need authentication) I made a
    >second project. Here the <authorization>-tag in the web.config stated
    ><allow users="*">
    >
    >But, since my application is not really big I thought this is too much
    >work (i.e. creating two projects); since I only need authentication
    >for half of my ASP.NET pages. Maybee there is another way. I was
    >thinking of making a new login-form where I set an attribute in the
    >session state. Then in every page which needs authentication, I check
    >if this attribute is set in the page_load. If not so, redirect the
    >user to the login-form. To logout the user can either close the
    >browser of I redirect them to a form where the can sign-out (which
    >will delete the session attribute).
    >
    >Please share your thoughts about this. Maybe their are even (!) better
    >idea's.
    >
    >Kind regards,
    >
    >Jules Hoppenbrouwers
    >
    >< Don't reply by email. Use this forum instead.>
    >
    Nick Hertl Guest

  4. #3

    Default RE: Authentication in ASP.NET: best practice?

    Shoot... it looks like I've deleted those files. But just try creating new
    web.config files in the subdirectories with the settings that you want to
    override. It will tell you about it and throw an error if it doesn't like
    your configuration. And if it doesn't complain, try logging in and see
    what all you can access. I remember I figured this one out by brail with
    some help from my trusty ASP.NET unleashed book by Walther.

    This posting is provided "AS IS" with no warranties, and
    confers no rights.

    Please do not send e-mail directly to this alias. This
    alias is for newsgroup purposes only.

    Thanks
    Nick

    --------------------
    >I don't believe that your web.config must be global to the project. Try
    >creating a subdirectory for your project and put a second web.config in
    >there. Some settings cannot be overridden and it doesn't make sense to
    put
    >them in both locations, but the authentication and authorization stuff is
    >ok I think.
    >
    >You will want the root to allow anonymous access, but then for any of the
    >pages that are restricted and in your second folder, the web.config will
    >notice that you marked that one as needing authentication and redicect to
    >the login.aspx page you specified unless they are already logged in.
    >
    >I've done this before but don't have the project in front of me anymore to
    >send you my config files, but give that a try.
    >
    >-----------
    >
    >This posting is provided "AS IS" with no warranties, and
    >confers no rights.
    >
    >Please do not send e-mail directly to this alias. This
    >alias is for newsgroup purposes only.
    >
    >Thanks
    >Nick
    >
    >>I'd like to poll for some best practices about ASP.NET application
    >>security.
    >>
    >>Here's what it's about:
    >>I wanna develop an ASP.NET web application with VS.NET 2003. This
    >>application consists of some pages which are available for anonymous
    >>users and some that are NOT available for anonymous users (i.e. need
    >>authentication).
    >>
    >>To achieve this I set the web.config <authentication>-tag to <forms
    >>...> and <deny users="?"> in the <authorization>-tag. This will
    >>redirect every unkown user to my login-form. To allow anonymous users
    >>browse to the other pages (which don't need authentication) I made a
    >>second project. Here the <authorization>-tag in the web.config stated
    >><allow users="*">
    >>
    >>But, since my application is not really big I thought this is too much
    >>work (i.e. creating two projects); since I only need authentication
    >>for half of my ASP.NET pages. Maybee there is another way. I was
    >>thinking of making a new login-form where I set an attribute in the
    >>session state. Then in every page which needs authentication, I check
    >>if this attribute is set in the page_load. If not so, redirect the
    >>user to the login-form. To logout the user can either close the
    >>browser of I redirect them to a form where the can sign-out (which
    >>will delete the session attribute).
    >>
    >>Please share your thoughts about this. Maybe their are even (!) better
    >>idea's.
    >>
    >>Kind regards,
    >>
    >>Jules Hoppenbrouwers
    >>
    >>< Don't reply by email. Use this forum instead.>
    >>
    >
    >
    Nick Hertl 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