六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

寫一個(gè)容易的登陸控件

[摘要]login.ascx由于在頁(yè)面上很頻繁使用登陸,把它做成一個(gè)控件是很有必要的,下面就是我寫的一個(gè)簡(jiǎn)單的登陸控件,大家可以根據(jù)的需要完善一下。<%@ Import Namespace="System.Data" %><%@ Import Namespace=&q...
login.ascx

由于在頁(yè)面上很頻繁使用登陸,把它做成一個(gè)控件是很有必要的,下面就是我寫的一個(gè)簡(jiǎn)單的登陸控件,大家可以根據(jù)的需要完善一下。

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Oledb" %>
<script language="VB" runat="server">
Sub Page_Load(sender As Object,e As EventArgs)
session("Accessed")=false
If session("UserName")="" And Not IsPassLogin() then
lblLogin.visible=true
lblMessage.visible=false
IsPassLogin()
else
lblMessage.Text=ShowPrompt(True)
lblMessage.visible=true
lblLogin.visible=false
End If
End Sub
'用戶登陸驗(yàn)證
Public Function IsPassLogin() As Boolean
Dim MyConnection As OledbConnection
Dim strConnection As String="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("DataBase/popmarry.mdb")
MyConnection=New OledbConnection(strConnection)
Dim sqlCommand="SELECT * FROM InMember WHERE MemberID='" & UserID & "'" & " AND Pwd='" & UserPassword & "'"

Dim MyAdapter As New OleDbDataAdapter(sqlCommand,MyConnection)
Dim ds As DataSet=New DataSet()
MyAdapter.Fill(ds,"InMember")
Dim dt As DataTable=ds.Tables("InMember")
If dt.Rows.Count>0 Then
Session("UserName")=UserID
Return(true)
Else
Return(false)
End If
End Function

'顯示登陸信息
Public Function ShowPrompt(bolInfo As Boolean) As String
If bolInfo Then
Dim strWelcome As String
strWelcome="<table width='165' cellpadding='3' border='0' align='center'><tr><td align='center'>歡迎您,<font color='#FF0000'>" & Session("UserName") & "</font></td></tr><tr><td align='center'>"
strWelcome &="<table width='150' border='0'><tr><td align='center'>狀態(tài): <font color='#FF3300'>新婚網(wǎng)會(huì)員</font></td></tr>"
strWelcome &="<table width='110' border='0'><tr><td align='center'>控制面板</td><td align='center'><a onclick='return LogoutConfirm()' href='login/logout.aspx'>退出登錄</a></td></tr></td></tr>"
'返回成功登陸信息
Return(strWelcome)
Else
Dim strError As String
strError="<table width='130'align='center'><tr><td>登錄失。<br>1.用戶名或密碼錯(cuò)誤<br>2.此帳號(hào)被鎖定<br>3.未<a href='../register/Register.asp' target='_blank'>注冊(cè)</td></tr>"
strError &="<tr><td height='20'><center><a href='javascript:onclick=history.go(-1)'>【返回】</a></center></td></tr></td></tr>"
'返回登陸失敗信息
Return(strError)
End If
End Function

Public Property UserID As String
Get
UserID=txtUserID.Text
End Get
Set
txtUserID.Text=value
End Set
End Property

'定義UserPassword的屬性
Public Property UserPassword As String
Get
UserPassword=txtUserPassword.Text
End Get
Set
txtUserPassword.Text=value
End Set
End property
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="168">
<tr>
<td>
<asp:label ID="lblLogin" runat="server">
<table width="168" height="60">
<tr>
<td width="63" align="center">用戶名:</td>
<td colspan="2" align="left">
<asp:textbox BorderStyle="Groove" Height="20" Width="90px" runat="server" ID="txtUserID" />
<asp:requiredfieldvalidator ControlToValidate="txtUserID" Display="Dynamic" ID="rfdUserID" runat="server" ErrorMessage="<font color=red>*</font>" />
</td>
</tr>
<tr>
<td align="center">密 碼:</td>
<td colspan="2" align="left">
<asp:textbox BorderStyle="Groove" Height="20" Width="90px" runat="server" TextMode="Password" ID="txtUserPassword" />
<asp:requiredfieldvalidator ControlToValidate="txtUserPassword" Display="Dynamic" ID="rfdPassword" runat="server" ErrorMessage="<font color=red>*</font>" />
</td>
</tr>
<tr align="center">
<td colspan="3"><input name="image" type="image" src=http://cfan.net.cn/info/"images/form_login.gif" width="40" height="18" border="0">
&nbsp; <img src=http://cfan.net.cn/info/"images/form_reg.gif" width="40" height="18" border="0">&nbsp;
<img src=http://cfan.net.cn/info/"images/form_lost.gif" width="60" height="18" border="0"></td>
</tr>

</asp:label>
<asp:label ID="lblMessage" runat="server">
<table width="100%">
<tr>
<td>&nbsp;</td>
</tr>

</asp:label>
</td>
</tr>





主站蜘蛛池模板: 特色一级黄色片 | 中文字幕乱码系列免费 | 日本国产欧美 | 日韩中文字幕视频在线观看 | 深爱婷婷 | 中国国产一级毛片视频 | 日韩毛片大全免费高清 | 欧洲免费极品videos | 日韩美女黄大片在线观看 | 午夜在线日韩免费精品福利 | 一二三中文乱码亚洲乱码 | 热思思久久 | 日韩中文字幕久久精品 | 日韩精品中文字幕久久 | 日本精品视频在线 | 日本另类αv欧美另类aⅴ | 日本理论视频 | 天天操天天操 | 亚洲刺激视频 | 七七七久久久久人综合 | 亚洲经典在线观看 | 日韩专区在线播放 | 天天天天天天干 | 亚洲区在线 | 中文字幕亚洲一区 | 特级黄色毛片视频 | 亚洲欧美日韩专区一 | 亚洲午夜在线观看 | 午夜精品久久久 | 天天看片天天a免费观看 | 亚洲欧美一区二区三区在线观看 | 天天好b | 日韩在线专区 | 日本一区二区三区免费高清在线 | 天天骑天天干 | 色网址在线 | 亚洲欧美韩日 | 综合色久 | 亚洲欧美日本在线观看 | 亚洲欧美日韩专区一 | 日韩理论片在线观看电视 |