ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

vs2015 dynamicweb6-1 模拟用户注册

2021-04-03 10:59:26  阅读:161  来源: 互联网

标签:Web 用户注册 Text vs2015 System UI dynamicweb6 using aspx


webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="dynamicweb6_1.WebForm1" %>

<!DOCTYPE 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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>用户注册</h3>
        用户名:<asp:TextBox ID="txtName" runat="server"></asp:TextBox><br />
        密码:<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox><br />
        <asp:Button ID="btnSubmit" runat="server" Text="注册" OnClick="btnSubmit_Click" /><br />
        <asp:Label ID="lblTips" runat="server" Text=""></asp:Label>
    </div>
    </form>
</body>
</html>

webform1.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace dynamicweb6_1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtName.Text))
            {
                lblTips.Text = "输入用户名";
                txtName.Focus();
            }
            else if (string.IsNullOrEmpty(txtPassword.Text))
            {
                lblTips.Text = "输入密码";
                txtPassword.Focus();
            }
            else
            {
                lblTips.Text = "注册成功";
                string url1 = "WebForm2.aspx?name=" + txtName.Text 
                    + "&pwd=" + Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(txtPassword.Text));
                Response.Redirect(url1);
            }
        }
    }
}

webform2.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="dynamicweb6_1.WebForm2" %>

<!DOCTYPE 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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
    </div>
    </form>
</body>
</html>

webform2.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace dynamicweb6_1
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["name"] != null)
            {
                lblMsg.Text = "用户名是" + Request.QueryString["name"] 
                    + ",密码是" + System.Text.Encoding.Default.GetString(Convert.FromBase64String(Request.QueryString["pwd"]));
            }
        }
    }
}

 

标签:Web,用户注册,Text,vs2015,System,UI,dynamicweb6,using,aspx
来源: https://blog.csdn.net/modern358/article/details/115392053

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有