Forms Authentication with SQL Server

T

thebison

Hi everyone,

Quick question, I'm creating a Timesheet Application with ASP.NET C# in
Visual Studio 2003. The database has been built using MSDE. I have
followed the MSDN libraries guide to creating forms based
authentication from

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetht03.asp

This works fine, however all the code does is return a message to a
label on screen saying that the user has been authenticated. What I
need is for the application to forward the user on to the default.aspx
form, and allow them to access all subsequent forms from there. I
suspect I need to insert some code in the passwordVerifed part.

if (passwordVerified == true )
{
// The user is authenticated
// At this point, an authentication ticket is normally created
// This can subsequently be used to generate a GenericPrincipal
// object for .NET authorization purposes
// For details, see "How To: Use Forms authentication with
// GenericPrincipal objects
lblMessage.Text = "Logon successful: User is authenticated";


I think it may be something along the lines of
FormsAuthentication.redirect but as I'm a newbie I'm probably wrong!..

As well as this, once I have redirected the verified user to the
correct page, do I then need some additional code at the top of each
form to check the user is verified?

Any help will be much appreciated!
Thanks in advance..

Al
 
W

W.G. Ryan eMVP

RedirectFromLoginPage is how to accomplish it. Once authenticated then if a
user tries to hit a page, he'll/she'll be redirected to the login page and
then back where they came from afterward. However you will probably want
some more granularity and has special Session variables set indicating the
level of access they have.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top