Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 20th, 2006, 06:12 AM
Authorized User
 
Join Date: Oct 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default creating username and password

hi am new to asp.net n trying to build a website..
i want to make a login form and it should check the correct username and password...
but nt getting how to do it..
here is the code that i have tried for it...


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Response.Buffer = True
        Response.Expires = -1000
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If Request.Form("submit") = "submit" Then
            checkloginform()
        Else
            showloginform()
        End If
    End Sub
    Sub checkloginform()
        If Request.Form("username") = "administrator" And Request.Form("password") = "password" Then
            Session("blnloggedin") = True
            Response.Redirect("confidential.aspx")
        Else
            Response.Write("<div align='center'>You are not logged in.</div><br>")
            Dim str As String
            str = "The username and password entered by you doesnot match"
            Response.Write(str)
            showloginform()
        End If
    End Sub
    Sub showloginform()

    End Sub

also the name of my textboxes is textbox1 and textbox2 for username and password respectively...
and the button name is button1..
hope anyone can help me...
thnx in advance

 
Old December 20th, 2006, 11:16 AM
Registered User
 
Join Date: Dec 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

why dont you just see
if(TextBox1.Text == "whatever" & TextBox2.Text == "whatever")
{

Set Session
Redirect

}
else
{

Inform user of invalid login

}

 
Old December 20th, 2006, 01:20 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Or better yet, use the built-in security features from ASP.NET 2.0:

http://quickstarts.asp.net/QuickStar...y/default.aspx

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 20th, 2006, 06:05 PM
Registered User
 
Join Date: Dec 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Didnt realize this was 2.0






Similar Threads
Thread Thread Starter Forum Replies Last Post
username and password : IIS gemini_shooter Dreamweaver (all versions) 18 July 16th, 2008 04:45 PM
Username and password for IIS siria-leon ASP.NET 3.5 Basics 1 June 3rd, 2008 08:20 AM
Regarding Username and password kuku_ashu Javascript How-To 0 January 4th, 2008 11:28 AM
username and password abhi_loveu2002 ASP.NET 2.0 Basics 1 December 14th, 2006 05:25 AM
Username and password Hennie Access 1 July 28th, 2006 12:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.