Let the user authentication work at the BasePage, is it suitable?

Discussion in 'ASP .Net' started by Benny Ng, Sep 18, 2005.

  1. Benny Ng

    Benny Ng Guest

    Hi,all,
    Now I let every .aspx page inherited from BasePage, and let the
    authentication work at there.
    sample code:
    if (session["user"]=="")
    {
    //Redirect to login page
    Response.Redirect ("login.aspx");
    }

    is this method right? and suitable for the .NET development's habit?

    Because this method is study from my traditional ASP development.(likes
    included a authentication page in every ASP pages)

    And now I prepare to used this style
    "FormsAuthentication.RedirectFromLoginPage" authentication mode to do the
    auth module.Any special things I need to take care?

    And any suggestion are appreciated.

    Thank you very much.

    Benny Ng
     
    Benny Ng, Sep 18, 2005
    #1
    1. Advertisements

  2. Benny Ng

    darrenkopp Guest

    If you are using forms authentication and all pages in the application
    require a user to be logged in, set the following up in your web.config
    in the authentication section.

    <configuration>
    <system.web>
    <authentication mode= "Forms">
    <forms name=".SITEAUTH" loginUrl="Login.aspx" />
    </authentication>
    </system.web>
    </configuration>

    information about forms authentication can be found at
    http://samples.gotdotnet.com/quickstart/aspplus/doc/formsauth.aspx.

    -Darren Kopp
     
    darrenkopp, Sep 19, 2005
    #2
    1. Advertisements

  3. Benny Ng

    Benny Ng Guest

    Ah..Yes. I saw this before. Now i goto checkout this article.Thank you very
    much.

    Benny Ng
     
    Benny Ng, Sep 19, 2005
    #3
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.