Custom Authentication

Topics: Web Client Software Factory
Apr 8, 2008 at 12:57 PM
Here is my situation: I am using the February 2008 release of the WCSF and I am trying to figure out how to create a custom login. This custom login needs to have two steps. Step 1: Forms authentication, just like the hands on lab 6 (done, works great). After the user authenticates I need to ask the user needs to answer 3 of 5 questions. So I set a DestinationPageUrl on the asp:Login, which work, but as the DestinationPageUrl load, so does all of the modules the user has access to. I do not want the modules to load until the user has answered their questions on the DestinationPageUrl.

Any help would be greatly appreciated.
Apr 10, 2008 at 10:12 PM
One possible solution is create a new role (i.e. QuizPassed) and add it to your rules (excepting the ones that applies to the question pages). When the user logs in it will have access to the question pages only, once the user has answered the questions, add the role (QuizPassed) in this way:
Roles.AddUserToRole(User.Identity.Name, "QuizPassed"); 
Then, with the new role added, the user will have access to the rest of the application.
The last step is to reload the Site map according to the new rules, for doing this check this post:

Remember that the second time the user logs in, it already have the QuizPassed role. If you want the user do the quiz every time it logs in you have to remove the role from the user, when it logs out or the session ends.

Please let me know if this helps.

Jonathan Cisneros