Google Answers Logo
View Question
Q: VB ASP.NET Cookie Based Authentication Code - How To? ( Answered 3 out of 5 stars,   0 Comments )
Subject: VB ASP.NET Cookie Based Authentication Code - How To?
Category: Computers > Programming
Asked by: sailor94708-ga
List Price: $25.00
Posted: 17 Dec 2002 09:39 PST
Expires: 16 Jan 2003 09:39 PST
Question ID: 126038
I need the following:

Code for authenticating a user using cookies.  The platform is NT,
.Net VB ASP using IIS.


. Forms authentication, a simple html form on the client side is used
to collect the user credetials.  The html form submits the user
credentials to the application for authentication.  If the user is
authenticated, the application issues a cookie to the user.  (Forms
authentication is also called cookie-base authentication).  If the
requested resource does not contain the cookie, the application
redirects the user to the login page.  The user credentials are stored
in SQL Server.


. Need the VB code for the above description.
- Cookie code, and where to place it.
. VB code on handling the cookie.
- Code should cover logic on how to determine if this person has been
logged in and handling userids and passwords. 

I want a working solution.  Please don't respond if you are unsure of
what I'm talking about.
Subject: Re: VB ASP.NET Cookie Based Authentication Code - How To?
Answered By: theta-ga on 17 Dec 2002 10:58 PST
Rated:3 out of 5 stars
Hi sailor94708-ga,
         Implementing Forms based authenticationn involves the
following steps :

   - Modify the web.config file to configure your web application to
deny anonymous access
   - Modify web.config file to specify authentication mode as Forms.
Here you also specify the cookie that will be used by your application
for authentication.
   - Create a aspx login page that accepts user id and password and
sets authentication cookie
   - Modify web.config to specify a page that will be acting as login
   - You can now create the other pages of our site. If the user tries
to view any of these pages without first logging in, he will be
automatically redirected to the login page you specified in web.config

You can find the required and code, with step by step
instructions for implementing Formbased authentication using an SQL
database, in the following MS KnowledgeBase Article :
        - Microsoft Knowledge Base Article - 308157  
          HOW TO: Implement Forms-Based Authentication in Your ASP.NET
Application by Using Visual Basic .NET

Alternatively, you can download and run the code for a sample .net
project which implements the steps specified above from :
              - DotNetBips :Forms authentication in ASP.NET
                by Bipin Joshi
                ( )

The following articles should help you gain a better understanding of
the options available to you :
      - CodeNotes : NET080016 - ASP.NET Authentication
        ( )
      - ASP.NET QuickStart tutorial: Forms-Based Authentication

Hope this helps.
If you need any clarifications, just ask!


Google Search Terms Used :
               cookie based authentication using asp

Request for Answer Clarification by sailor94708-ga on 18 Dec 2002 20:22 PST
I am reviewing tonight, I'll let you know soon.


Clarification of Answer by theta-ga on 20 Dec 2002 07:23 PST
Hi Patrick,
   Take your time.  :-)
   If you need any further clarifications, I will be glad to help.
   Happy Holidays!

sailor94708-ga rated this answer:3 out of 5 stars

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy