20151221:Web复习:登陆

前台HTML代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Denglu.aspx.cs" Inherits="Denglu" %>

<!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>
    <style type="text/css">

                * {
                    margin: 0px auto;
                    padding: 0px;
                }
     </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="aa" style="width:400px">
        <h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h1>
        <h1>&nbsp;</h1>
        <h1>&nbsp;</h1>
        <h1>&nbsp;</h1>
        <h1>&nbsp;</h1>
        <h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 登录</h1>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Label ID="Label1" runat="server" Text="用户名:"></asp:Label>
        <asp:TextBox ID="txtUid" runat="server"></asp:TextBox>
        <br />
        <br />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Label ID="Label2" runat="server" Text="密码:"></asp:Label>
        <asp:TextBox ID="txtPwd" runat="server" TextMode="Password"></asp:TextBox>
        <br />
        <br />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" Text="登陆" OnClick="Button1_Click" />

        <asp:Literal ID="Literal1" runat="server"></asp:Literal>

    </div>
    </form>
</body>
</html>

后台C#代码:

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

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        TextDataContext context = new TextDataContext();
        //取值
        string uid = txtUid.Text;
        string pwd = txtPwd.Text;
        //查询
        var query = context.login1.Where(p => p.username == uid && p.password == pwd);
        //判断
        if (query.Count() > 0)
        {
            Session["uid"] = uid;
            Response.Redirect("Main.aspx");
        }
        else
        {
            Literal1.Text = "<script type=‘Text/javascript‘>alert(‘用户名或密码错误!‘);</script>";
        }
    }
}

时间: 2024-08-06 17:18:05

20151221:Web复习:登陆的相关文章

java web程序 登陆验证页面 4个页面人性化设置

到这里,快期末考试了,老师不讲课,我心里有苦不想说,也许没有考虑到老师的感受,让老师难堪了 但是我的行为已不再是我可以做的了.不可能了,我只是职业性的机械的做事了. 思路: 1.第一个是form表单,用户输入用户名和密码,点击登陆按钮 a.jsp 2.第二是验证页面,如果不是那个用户名和密码,则显示登陆失败或错误,点击链接重新登陆ok.jsp d.jsp 3.当用户为输入任何数据,即为空的时候,则提示用户先登录,c.jsp 第一个页面,就不写了 验证页面 ok.jsp ? 1 2 3 4 5 6

Python 爬虫案例-web微信登陆与消息发送

首先回顾下网页微信登陆的一般流程 1.打开浏览器输入网址 2.使用手机微信扫码登陆 3.进入用户界面 1.打开浏览器输入网址 首先打开浏览器输入web微信网址,并进行监控: https://wx.qq.com/ 可以发现网页中包含了一个新的url,而这个url就是二维码的来源. https://login.weixin.qq.com/qrcode/wbfd1Z-a0g== 可以猜测一下获取url的一般网址就是https://login.weixin.qq.com/qrcode,而wbfd1Z-a

20151221:Web复习:主界面

前台HTML代码: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Main.aspx.cs" Inherits="_Main" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server

20151221:Web复习:添加

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Insert.aspx.cs" Inherits="Insert" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"&

20151221:Web复习:修改

后台: public partial class Update : System.Web.UI.Page { private TextDataContext context = new TextDataContext(); protected void Page_Load(object sender, EventArgs e) { if (Session["uid"] != null) { if (!IsPostBack) { //给民族下拉列表绑定数据 drNation.DataSo

【原】web页面登陆验证

using Itcast.Mall.Model; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; namespace Itcast.Mall.WebApp.Code { //AuthBasePage是自己新建的一个类,然后让这个类继承System.Web.UI.Page; public class AuthBasePage:Page

使用Web界面登陆vSphere

在没有vSphere Client的情况下如何管理虚拟化平台?不在Windows的操作系统上,又该如何管理?这都不需要担心,在vSphere中,VMware提供了基于浏览器对虚拟化基础设施进行管理的vSphere Web Client,使得管理员可以通过Web方式来管理虚拟化的平台. vSphere Web Client是安装在Windows服务器上的一个应用程序,其基于浏览器的方式提供了图形用户界面,具有传统vSphere Client的多数功能,比如查看主机以及虚拟机清单,对主机.虚拟机.模

基于Flask 实现Web微信登陆

网页版微信登陆网址 https://login.wx.qq.com/ 获取微信登陆的二维码 在浏览器中访问登陆接口 https://login.wx.qq.com/ 我们查找二维码的图片可以看到 其中src为 https://login.weixin.qq.com/qrcode/Yd5dz5xUnw==" 而我们每次刷新都会生成一个新的二维码 多刷新几次我们会发现二维码中src最后面的qrcode/......值每次都会改变 ,索引肯定会有一些请求可以获取这些值 我们继续追踪发现下面的地址会返回

利用api接口来实现web网页登陆

因为公司的所有链接数据库的都是用的api接口  最近做了一个用api接口登陆 function Login() { if (!Validate()) { return false; } var para = {}; para.action = "login_by_api"; para.login_name = $.trim($("#txtLoginName").val()); para.password = $.trim($("#txtPassword&q