Jump to content




Recent Status Updates

  • Photo
      30 Sep
    rhossis

    laptop hard disk seated beneath motherboard but with no access panel. 7 hours to replace :(

    Show comments (3)
  • Photo
      19 Sep
    Chall

    I love it when you go to write a help thread, then while writing, you reach an enlightenment, and figure it out yourself.

    Show comments (3)
View All Updates

Developed by Kemal Taskin
Photo
- - - - -

ASP Login Help

asp login help showing up not register signup logout

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 huggy11911

huggy11911

    CC Lurker

  • New Member
  • Pip
  • 7 posts

Posted 26 February 2013 - 11:50 AM

I can't find any type of login script online that works. I am new to ASP and I am having the hardest time trying to find a login script that will work. I am using IIS and WebMatrix and nothing seems to work. I am looking to create a login screen, register, User CP, and logout. This code I have below is throwing errors in the CSS part saying that the code can't be there. The <InstructionTextStyle>,<LoginButtonStyle>, <TextBoxStyle> and <TitleTextStyle> are throwing the following errors:
 
 
Unknown element 'instructiontextstyle' or element cannot be placed here.    Login.aspx    20    6[/list]Element 'InstructionTextStyle' cannot be nested inside element 'div'.    Login.aspx    20    6[/list]Unknown element 'loginbuttonstyle' or element cannot be placed here.    Login.aspx    21    10[/list]Element 'LoginButtonStyle' cannot be nested inside element 'div'.[/list]Unknown element 'textboxstyle' or element cannot be placed here.[/list]Element 'TextBoxStyle' cannot be nested inside element 'div'.[/list]Unknown element 'titletextstyle' or element cannot be placed here.[/list]Element 'TitleTextStyle' cannot be nested inside element 'div'.[/list]
 
The code doesn't seem like it will do anything at all. I have a SQL database but I would much rather use Access. In Access would I use an online database or just a regular database?. I want to be able to have a register form and all that along with it and security. I just can't find anything that will work for what I want to do.
 
If anyone has any ideas, could you please help me out. Any ideas about where to find a good login script that will meet my needs or any possible way to make this work and make it better!
 
Thank you in advance, appreciate all the help. I'm sorry I am a noob in ASP but I am willing to learn, just need to get this last part done soon!
 
I have attached a ZIP file containing the doecuments but for those of you who do not want to download the file here is the code:
 
 
Login.aspx.cs

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Configuration;


public partial class Login: System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        string username = Login1.UserName;
        string pwd = Login1.Password;
        string s;
        s = WebConfigurationManager.ConnectionStrings["ChartDatabaseConnectionString"].ConnectionString;
        SqlConnection con= new SqlConnection(s);
        con.Open();
        string sqlUserName;
        sqlUserName = "SELECT user_name,password FROM Login WHERE user_name ='" + username + "' AND password ='" + pwd + "'";
        SqlCommand cmd = new SqlCommand(sqlUserName, con);
        string CurrentName;
        CurrentName = (string)cmd.ExecuteScalar();
        if (CurrentName != null)
        {
            Session["UserAuthentication"] = username;
            Session.Timeout = 1;
            Response.Redirect("start.aspx");
            }
            else
            {
                Session["UserAuthentication"] = "";
            }
        }




    }
 

 

 
Login.aspx
 
Code:

 

<%@ Page Tite="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits"Login" %>


<asp:Content Id="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
.style2
{
font-size: large;
}
</style>
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div>
<h2 style="color: Green">
Login
</h2>


    <asp:Login ID="Login1" runat="Server" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPadding="4" BorderStlye="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333" Height="192px" Style="font-size: medium" Width="308px" onauthenticate="Login1_Authenticate">
        
    <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
        <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />
        <TextBoxStyle Font-Size="0.8em" />
        <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
   
         </asp:Login>
    </div>
</asp:Content>
 

 

Attached Files


Edited by Roger, 26 February 2013 - 01:53 PM.
removed format