当我单击注册时如何从登录页面进入注册页面 [英] How to go into signup page from login page when i click onto signup

查看:185
本文介绍了当我单击注册时如何从登录页面进入注册页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击注册时如何从登录页面进入注册页面



这是我的代码........登录系统;

How to go into signup page from login page when i click onto signup



this is my code........loginusing 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.Configuration;
using System.Data;

public partial class Default2 : System.Web.UI.Page
{
   

    SqlConnection con = new SqlConnection("Data Source=...........;Initial Catalog=EmployeeDB;Integrated Security=True");


    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnlogin_Click(object sender, EventArgs e)
    {
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from information where Username=@Username and Password=@Password", con);
        cmd.Parameters.AddWithValue("@Username", TextBox1.Text);
        cmd.Parameters.AddWithValue("@Password", TextBox2.Text);
        SqlDataAdapter ad = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        ad.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            Session["Username"] = TextBox1.Text;

            Response.Redirect("Default3.aspx");
        }
        else
        {
            Label3.Visible = true;
            Label3.Text = "Invalid username&password....!!!";

        }
      
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default5.aspx");
    }
}







这是我的sigup页面..........








this is my sigup page..........


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;

public partial class Default5 : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection("Data Source=.........;Initial Catalog=EmployeeDB;Integrated Security=True");

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnsave_Click(object sender, EventArgs e)
    {
        con.Open();
        string qry = "insert into information values('" +TextBox1.Text + "','" + TextBox2.Text + "','"+TextBox3.Text+"','"+TextBox4.Text+"','"+TextBox5.Text+"')"; 
        SqlCommand cmd = new SqlCommand(qry,con);
        cmd.ExecuteNonQuery();
        con.Close();
    }
}

推荐答案

首先,不要以明文形式存储密码-从安全角度来看,这是一个非常糟糕的主意.这里有一些说明将对您有所帮助:密码存储:操作方法. [^ ]

其次,为什么要手动执行所有这些操作?为什么不使用会员制,这意味着您不必检查每个页面上登录的用户,因为它首先不允许非用户访问该页面? 成员资格简介 [
First off, don''t store your passwords in clear text - it is a very bad idea from a security point of view. There are some notes here that will help: Password Storage: How to do it.[^]

Secondly, why are you doing all this manually? Why not use the Membership system, which will mean that you don''t have to check for user logged in on each page, because it won''t allow non-users access to the page in the first place? Introduction to Membership[^] It also provides all the common facilities...


这篇关于当我单击注册时如何从登录页面进入注册页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆