there... im having problem with this codings. these codings are meant for login purpose. i dont knw where ive gone wrong. are these the only codes, or are there any other codes that ive not included... please help

<%@ Page Language="VB" %>
<script language="VB" runat="server">

	Sub btnLogin_OnClick(Src As Object, E As EventArgs)
        If txtID.Text = "user" And txtPasswrd.Text = "pass" Then
            FormsAuthentication.RedirectFromLoginPage(txtID.Text, True)
            lblInvalid.Text = "Sorry... try again..."
        End If
	End Sub


<title>ASP.NET Login</title>

<h2>Please Login:</h2>

Hint: Username is &quot;user&quot; and Password is &quot;pass&quot;

<asp:Label id="lblInvalid" runat="server" />

<form id="Form1" runat="server">

	User ID : <asp:TextBox id="txtID" runat="server" /><br />
	Password: <asp:TextBox id="txtPasswrd" TextMode="password" runat="server" /><br />
	<br />
	<asp:Button id="btnLogin" runat="server"
		text="Login" OnClick="btnLogin_OnClick"

//Here's the page we're protecting:
<a href="login-protected.aspx">login-protected.aspx</a>.
If you're not logged in, clicking the link will bounce
you right back to this page.//


Recommended Answers

All 5 Replies

I dont see a Problem , you just posted html , what is your problem exactly ?

I dont see a Problem , you just posted html , what is your problem exactly ?

when i debug, there is alot more of error. im unaware of what i should actually do, especially, when i am hoping that the interface be working

Again i cant Help you, until you post the code that brings Errors , the code above is just an html, is it the code that gives an Error ?

what does an error says ?

hii,,this is wht i used in my page and it worked for me,,,i have used an image button,,,i have written this in the <head> tag

<script language="C#" runat="server">
		void Login_Click(Object sender, System.Web.UI.ImageClickEventArgs e) {

      // authenticate user: this samples accepts only one user with
      // a name of 'admin' and a password of 'ment123'

      if ((TextBox4.Text == "admin") && (TextBox3.Text == "ment123"))
        FormsAuthentication.RedirectFromLoginPage(TextBox4.Text, false);
      else {
        Label6.Text = "Invalid User";

It will be helpfull if u elaborate ur problem a bit more...
Hope this helps u

no need to use Response.Redirect if u r using formsauthentication .just set the default url in web.config.if returnurl query string presnt in the requested url then redirectfromlogpage will redirect page to return url otherwise it will redirect to default url..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.