茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    Ajax+asp.net實(shí)現(xiàn)用戶(hù)登陸
    來(lái)源:易賢網(wǎng) 閱讀:2944 次 日期:2015-03-31 11:39:30
    溫馨提示:易賢網(wǎng)小編為您整理了“Ajax+asp.net實(shí)現(xiàn)用戶(hù)登陸”,方便廣大網(wǎng)友查閱!

    這篇文章主要介紹了Ajax+asp.net實(shí)現(xiàn)用戶(hù)登陸,主要是為了練習(xí)ajax的使用方法,有需要的小伙伴參考下。

    以用戶(hù)登錄為例練習(xí)ajax的使用方法

    login.html

    <!DOCTYPE html>

    <html xmlns="">

    <head>

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

    <title></title>

    <script type="text/javascript">

    var obj = createobj();

    function login(name, pwd)

    {

    var urlstr = "=" + name + "&password=" + pwd;

    obj.open("get", urlstr, true);

    obj.onreadystatechange = dowork;

    obj.send();

    }

    function dowork()

    {

    if (obj.readyState == 4)

    {

    if (obj.status == 200)

    {

    document.getElementById("msg").innerText = obj.responseText;

    }

    }

    }

    //創(chuàng)建對(duì)象

    function createobj()

    {

    var xmlHttp = null;

    try {

    //非IE瀏覽器

    xmlHttp = new XMLHttpRequest();

    }

    catch (e)

    { //IE瀏覽器

    try{

    xmlHttp = new ActiveXObject("Msxml2.HTTP");

    }

    catch (e)

    {

    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

    }

    }

    return xmlHttp;

    }

    </script>

    </head>

    <body>

    <table>

    <tr>

    <td align="center" colspan="2">登錄</td>

    </tr>

    <tr>

    <td>用戶(hù)名:</td>

    <td><input type="text" id="username" name="username" /></td>

    </tr>

    <tr>

    <td>密碼:</td>

    <td><input type="password" id="password" name="password" /></td>

    </tr>

    <tr>

    <td >

    <input type="submit" value="登錄" onclick="login(document.getElementById('username').value,document.getElementById('password').value)" />

    </td>

    <td>

    <input type="reset" value="清空" />

    </td>

    <td><span id="msg"></span></td>

    </tr>

    </table>

    </body>

    </html>

    DAL.cs

    using System;

    using System.Collections.Generic;

    using System.Data;

    using System.Data.SqlClient;

    using System.Linq;

    using System.Web;

    namespace AJAXtest

    {

    public class DAL

    {

    private string connstr = "server=acer-pc;database=mydatabase;user id=sa;password=123456";

    public DataTable selectDB(string sql)

    {

    DataTable dt = new DataTable();

    try

    {

    SqlConnection conn = new SqlConnection(connstr);

    SqlDataAdapter sda = new SqlDataAdapter(sql, conn);

    sda.Fill(dt);

    }

    catch(Exception e)

    {}

    return dt;

    }

    }

    }

    BLL.cs

    using System;

    using System.Collections.Generic;

    using System.Data;

    using System.Linq;

    using System.Web;

    namespace AJAXtest

    {

    public class BLL

    {

    public bool login(string username,string password)

    {

    try

    {

    string sql = "select password from Users where username='" + username + "'";

    DAL sqlSelect = new DAL();

    DataTable dt = sqlSelect.selectDB(sql);

    if (dt.Rows[0]["password"].ToString() != password)

    return false;

    }

    catch (Exception)

    {

    }

    return true;

    }

    }

    }

    Server.aspx.cs

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Web;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    namespace AJAXtest

    {

    public partial class Server : System.Web.UI.Page

    {

    protected void Page_Load(object sender, EventArgs e)

    {

    string username = Request["username"].ToString();

    string password = Request["password"].ToString();

    BLL b = new BLL();

    if (b.login(username, password))

    {

    Response.Write("登錄成功");

    Response.End();

    }

    else

    {

    Response.Write("登錄失敗");

    Response.End();

    }

    }

    }

    }

    Server.aspx

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

    <!DOCTYPE html>

    <html xmlns="">

    <head runat="server">

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

    <title></title>

    </head>

    <body>

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

    <div>

    </div>

    </form>

    </body>

    </html>

    Ajax+asp.net實(shí)現(xiàn)用戶(hù)登陸 三聯(lián)

    名單

    以上所述就是本文的全部?jī)?nèi)容了,希望大家能夠喜歡。

    更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄

    更多信息請(qǐng)查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:Ajax+asp.net實(shí)現(xiàn)用戶(hù)登陸
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢(xún)回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢(xún)?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

    • 報(bào)班類(lèi)型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢(xún) | 簡(jiǎn)要咨詢(xún)須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專(zhuān)用圖標(biāo)
    聯(lián)系電話(huà):0871-65099533/13759567129 獲取招聘考試信息及咨詢(xún)關(guān)注公眾號(hào):hfpxwx
    咨詢(xún)QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專(zhuān)用圖標(biāo)