How do i force forms authentication

Posted on 2011-10-05
Medium Priority
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:Michael Sterling
  • 3

Author Comment

by:Michael Sterling
ID: 36919940
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....

Accepted Solution

LlamaJoe earned 2000 total points
ID: 36922479
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.  http://petermcintyre.wordpress.com/2010/02/10/getting-started-with-asp-net-membership-roles-and-profiles/

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).

Author Comment

by:Michael Sterling
ID: 36946463
still workin on this...

Author Closing Comment

by:Michael Sterling
ID: 36967969
thank you for your help

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

749 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