asp实现注册登录界面_asp.net 实现用户登录和注册——基于webform模式

cf218941abcdcbf398fe5b199406fb5e.gif点击上方蓝色字体,关注我们

   环境:Windows10 + VS2015 + 自带LocalDB

    看一下效果:

    1、注册页面:

1462f56a1e8189445a71c6d11c2c8676.png

如果用户重名:

cc206ff9594e0719550fe567d4299d35.png

2、登录页:

f334efac0c5e1ddd10fe74c8f26095ab.png

3、注册或者登录好了会跳到Home页面并且显示当前的用户

下面看看关键代码:

①注册前台页面Register.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="Album.OnlineAlbum.Register" %>

span style="box-sizing: border-box;outline: 0px;overflow-wrap: break-word;">html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title>注册title>

<style>

form{

color:#575454;

width:500px;

margin:20px auto;

font-size:15px;

}

.label{

color:red;

font-size:12px;

font-family:'Lucida Console';

}

input.Tb{

border-radius:5px;

}

.user_name{ width:240px; height:38px; line-height:38px; border:1px solid #000; background:url(login_img_03.png) no-repeat left center; padding-left:30px; }

.user_name input{ width:230px; height:36px; border:1px solid #fff;color:#666;}

.password{ width:240px; height:38px; line-height:38px; border:1px solid #dfe1e8; background:url(login_img_09.png) no-repeat left center; padding-left:30px; }

.password input{ width:230px; height:36px; border:1px solid #000;color:#666;}

.transButton {

border:solid 1px;

background-color:transparent;

}

#btnRegister{

font-size:14px;

}

#linkToLogin{

text-decoration:none

}

#ckItem{

text-decoration:none

}

body{

background-image:url("rbg.jpg");

}

style>

head>

<body>

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

<h2>欢迎注册OAh2>

<h3>每一天,记录美。h3>

<br />

<asp:ScriptManager ID="ScriptManager1" runat="server">

asp:ScriptManager>

<asp:TextBox runat="server" ID="rUserNameText" Height="40px" Width="490px" CssClass="Tb">asp:TextBox>

<br />

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>

<asp:CustomValidator ID="CustomValidator1" runat="server"

ControlToValidate="rUserNameText" ErrorMessage="*"

onservervalidate="CustomValidator1_ServerValidate">

asp:CustomValidator>

ContentTemplate>

asp:UpdatePanel>

<br />

<asp:TextBox runat="server" ID="rPsdText" TextMode="Password" Height="40px" Width="490px" CssClass="Tb">asp:TextBox>

<br />

<asp:UpdatePanel ID="UpdatePanel2" runat="server">

<ContentTemplate>

<asp:CustomValidator ID="CustomValidator2" runat="server"

ControlToValidate="rPsdText" ErrorMessage="*"

onservervalidate="CustomValidator2_ServerValidate">

asp:CustomValidator>

ContentTemplate>

asp:UpdatePanel>

<br />

<asp:TextBox runat="server" ID="rrPsdText" TextMode="Password" Height="40px" Width="490px" CssClass="Tb" >asp:TextBox>

<br />

<asp:UpdatePanel ID="UpdatePanel3" runat="server">

<ContentTemplate>

<asp:CustomValidator ID="CustomValidator3" runat="server"

ControlToValidate="rrPsdText&

  • 8
    点赞
  • 86
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值