求 asp.net登陆代码

kevinhu520 2008-06-02 05:00:36
求 asp.net登陆代码
求 asp.net登陆代码
求 asp.net登陆代码求 asp.net登陆代码
求 asp.net登陆代码
...全文
234 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
win7cc 2008-06-02
  • 打赏
  • 举报
回复
看你用什么语言啊 用DATAREADER来判断啊
shinevi 2008-06-02
  • 打赏
  • 举报
回复
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CommonFunc.Utility;

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

if (HttpContext.Current.Session.Count > 0)
{
HttpContext.Current.Session.RemoveAll();
HttpContext.Current.Session.Abandon();
}

string msgCode = (string)HttpContext.Current.Request["msgCode"];
if (msgCode != null)
{
if (msgCode == "1")
msgCode = "Msg_Login_OverTime";

string msg = ConfigurationManager.AppSettings[msgCode];
if (msg != null)
labMsg.Text = msg;
}
}

protected void btnLoginIn_Click(object sender, ImageClickEventArgs e)
{/*
if (txtUID.Value != "" && txtPWD.Value != "")
{
string connStr = ConfigurationManager.ConnectionStrings["ComMgrSys"].ConnectionString;
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
string sqlStr = "select PassWord from UserInfo where UserID='" + txtUID.Value + "'";
SqlCommand comm = new SqlCommand(sqlStr, conn);
SqlDataReader read = comm.ExecuteReader();
if (read.HasRows)
{
read.Read();
string pwd = read["PassWord"].ToString();
if (txtPWD.Value != pwd)
labMsg.Text = ConfigurationManager.AppSettings["Msg_Login_PWDError"];
else
{
read.Close();
string logdate = DateTime.Now.ToString();
string sql = "insert into SysLog values('" + txtUID.Value + "','" + logdate + "')";
SqlCommand comm1 = new SqlCommand(sql, conn);
comm1.ExecuteNonQuery();
Response.Redirect("index.aspx");
}
}
else
labMsg.Text = ConfigurationManager.AppSettings["Msg_Login_LoginIDError"];
}*/
CheckUser(txtUID.Value, txtPWD.Value);
}

private void CheckUser(string uid, string pwd)
{
string res;
ComMgrSys cms = new ComMgrSys();
res = cms.checkuser(uid, pwd);
if (!res.Equals("0"))
labMsg.Text = res;
}
}
shinevi 2008-06-02
  • 打赏
  • 举报
回复

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>登陆</title>
<link href="Css/Style.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript">
function closeMe()
{
window.opener = null;
close();
}
function clear()
{
document.getElementById("txtUID").setAttribute("value","");
}
</script>
</head>
<body style="margin:0; font-size:9pt; font-family:宋体; overflow:hidden; scrollbar-3dlight-color:lightslategray;scrollbar-base-color:#f7f7f7; scrollbar-darkshadow-color:#f7f7f7;" oncontextmenu="return false;" scroll="no">
<form id="form1" method="post" runat="server" >
<table style="height:764px; border:0;" align="center">
<tr>
<td valign="top" align="center">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" border="1" style="height:238px; width: 397px; border-color:silver;">
<tr>
<td colspan="2" style="height:35px;border-color:black;background-position: center center; background-attachment: fixed; background-image: url(Img/login.jpg); background-repeat: no-repeat;" >
</td>
</tr>
<tr style="height:180px">
<td style="background-image: url(Img/login_bg.jpg); background-position: center center; background-repeat: no-repeat;">
<table cellpadding="0" cellspacing="0">
<tr style="height:70" valign="bottom">
<td align="right" style="width: 134px">
<font size="9pt" style="font-size: 9pt; font-family: 宋体">用户名: </font>
</td>

<td align="left" style="width: 288px; height: 50px;">
<input id="txtUID" type="text" value="" runat="server" style=" border:solid 1px; width:150px; height: 18px;"/>
<asp:RequiredFieldValidator ID="validatorUserName" runat="server" ErrorMessage="请输入用户名" ControlToValidate="txtUID" Font-Names="宋体" Font-Size="9pt"></asp:RequiredFieldValidator></td>
</tr>
<tr style="height:70" valign="bottom">
<td align="right" style="width: 134px; height: 50px;">
<font size="9pt" style="font-size: 9pt; font-family: 宋体;">密  码: </font>
</td>
<td align="left" style="width: 288px; height: 50px;">
<input id="txtPWD" type="password" runat="server" style="width: 150px; border-right: 1px solid; border-top: 1px solid; border-left: 1px solid; border-bottom: 1px solid; height: 18px;"/>
<asp:RequiredFieldValidator ID="validatorPWD" runat="server" ControlToValidate="txtPWD"
ErrorMessage="请输入密码" Font-Names="宋体" Font-Size="9pt"></asp:RequiredFieldValidator></td>
</tr>
<tr style="height:90" valign="bottom">
<td style="width: 134px; height: 90px;" align="right"/>
<td style="width: 288px; height: 90px;" align="left">
<asp:ImageButton ID="btnLoginIn" runat="server" AlternateText="登陆" BorderWidth="1px" ForeColor="White" Height="25px" ImageUrl="Img/LoginIn.gif" Width="60px" BorderColor="Black" OnClick="btnLoginIn_Click" />
    <a onclick="clear();"><img src="Img/loginOut.gif" alt="退出" border="1px" /></a>
<br />
<asp:Label ID="labMsg" runat="server" ForeColor="Red" Font-Names="宋体" Font-Size="9pt"></asp:Label>
<br />
<br />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧