How do i force forms authentication

Posted on 2011-10-05
Last Modified: 2012-05-12
My web app is built in ASP .NET 3.5 [C#]. I want to force users to authenticate using forms authentication. When a user initially comes to any number of pages within a subset of pages within my site, let's say 5 pages total, i want then to have to authenticate. But only once, for any page within that subset of five pages. So that when once they authenticate once, then are free to go to any page in the site, including the other 4 pages without having to authenticate again. How do I achieve this. I'm somewhat familiar with how this is supposed to work, but the details of what i need to do / put in place / configure are escaping me right now. I need to know what my web.config should look like; what code i need to right for my login.aspx page and any other minimum coding, or settings that i will need in place to accomplish this. Any help would be appreciated. I've looked into links / articles but they seem to be more confusing than anything, i may need more of a step by step approach to this thing...
Question by:mikesExpertExchange
    LVL 1

    Author Comment

    additionally, if my web application will live in a "web farm" environment, is forms authentication the best way to go? or, should i simply force the user to authenticate on each page that i need them to? i may post this question separately....
    LVL 5

    Accepted Solution

    Forms Authentication is fine - you just need to set a FormsAuthenticationTicket cookie.  The "easiest" way is to use the built-in membership provider - but it does has a steep initial learning curve.

    if you are talking about internal users on a domain, then use windows authentication rather than forms authentication.

    Or, on your login page, simply set a cookie Reponse.Cookies["authenticated"].Value = true;
    then check if the cookie is present on page_load on each page.  (this is essentially what the membership provider does, just with a whole bunch more security).
    LVL 1

    Author Comment

    still workin on this...
    LVL 1

    Author Closing Comment

    thank you for your help

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now