好看的茶叶登录页面(好看的注册登录页面)

趣茶网 51 本文有1727个文字,大小约为6KB,预计阅读时间5分钟

求一个好看的ASP.NET登录界面,在线等啊

母版页页面代码

<%@?master?language="c#"?autoeventwireup="true"?codefile="masterpage.master.cs"?inherits="masterpage"?%>


<!doctype?html?public?-//w3c//dtd?xhtml?1.0?transitional//en??>
<html?xmlns=?>
<head?runat="server">
?<title>无标题页</title>
</head>
<body>
?<form?id="form1"?runat="server">
?<div>
<asp:scriptmanager?id="scriptmanager1"?runat="server">
</asp:scriptmanager>
<asp:updatepanel?runat="server">
<contenttemplate>
<asp:panel?id="pllogin"?runat="server">
<p>
用户名:<asp:textbox?id="txtname"?runat="server"></asp:textbox>
&nbsp;密码:<asp:textbox?id="txtpass"?runat="server"?textmode="password"></asp:textbox>
<asp:button?id="btnlogin"?runat="server"?text="登录"?onclick="btnlogin_click"?/>
</p>
</asp:panel>
<asp:panel?id="plhello"?runat="server">
<asp:label?id="lblname"?runat="server"></asp:label>,欢迎你!
<asp:linkbutton?id="lbout"?runat="server"?onclick="lbout_click">退出</asp:linkbutton>
</asp:panel>
</contenttemplate>
</asp:updatepanel>
<asp:contentplaceholder?id="contentplaceholder1"?runat="server">
</asp:contentplaceholder>
?</div>
?</form>
</body>
</html>
母版页逻辑代码

using?system;
using?system.collections;
using?system.configuration;
using?system.data;
using?system.linq;
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?system.xml.linq;


public?partial?class?masterpage?:?system.web.ui.masterpage
{
?protected?void?page_load(object?sender,?eventargs?e)
?{
if?(session["user"]?==?null)
{
this.plhello.visible?=?false;
}
else
{
this.pllogin.visible?=?false;
this.lblname.text?=?session["user"].tostring();
}
?}


?protected?void?btnlogin_click(object?sender,?eventargs?e)
?{
if?(this.txtname.text?==?"l.s.")
{
if?(this.txtpass.text?==?"l.s.")
{
this.lblname.text?=?this.txtname.text;
this.pllogin.visible?=?false;
this.plhello.visible?=?true;
session["user"]?=?"l.s.";
}
else
{
scriptmanager.registerstartupscript(btnlogin,gettype(),?"",?"alert('密码输入错误!')",?true);
}
}
else
{
scriptmanager.registerstartupscript(btnlogin,?gettype(),?"",?"alert('用户名不存在!')",?true);
}
?}
?protected?void?lbout_click(object?sender,?eventargs?e)
?{
session.remove("user");
this.pllogin.visible?=?true;
this.plhello.visible?=?false;
this.txtname.text?=?"";
?}
}
应用母版页的页面

<%@?page?language="c#"?masterpagefile="~/masterpage.master"?autoeventwireup="true"?codefile="default.aspx.cs"?inherits="_default"?title="无标题页"?%>


<asp:content?id="content1"?contentplaceholderid="contentplaceholder1"?runat="server">
say?say?hello!
</asp:content>
输入用户名,密码

登录后

退出后

求一个好看的ASP.NET登录界面,在线等啊

母版页页面代码

<%@?master?language="c#"?autoeventwireup="true"?codefile="masterpage.master.cs"?inherits="masterpage"?%>


<!doctype?html?public?-//w3c//dtd?xhtml?1.0?transitional//en??>
<html?xmlns=?>
<head?runat="server">
?<title>无标题页</title>
</head>
<body>
?<form?id="form1"?runat="server">
?<div>
<asp:scriptmanager?id="scriptmanager1"?runat="server">
</asp:scriptmanager>
<asp:updatepanel?runat="server">
<contenttemplate>
<asp:panel?id="pllogin"?runat="server">
<p>
用户名:<asp:textbox?id="txtname"?runat="server"></asp:textbox>
&nbsp;密码:<asp:textbox?id="txtpass"?runat="server"?textmode="password"></asp:textbox>
<asp:button?id="btnlogin"?runat="server"?text="登录"?onclick="btnlogin_click"?/>
</p>
</asp:panel>
<asp:panel?id="plhello"?runat="server">
<asp:label?id="lblname"?runat="server"></asp:label>,欢迎你!
<asp:linkbutton?id="lbout"?runat="server"?onclick="lbout_click">退出</asp:linkbutton>
</asp:panel>
</contenttemplate>
</asp:updatepanel>
<asp:contentplaceholder?id="contentplaceholder1"?runat="server">
</asp:contentplaceholder>
?</div>
?</form>
</body>
</html>
母版页逻辑代码

using?system;
using?system.collections;
using?system.configuration;
using?system.data;
using?system.linq;
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?system.xml.linq;


public?partial?class?masterpage?:?system.web.ui.masterpage
{
?protected?void?page_load(object?sender,?eventargs?e)
?{
if?(session["user"]?==?null)
{
this.plhello.visible?=?false;
}
else
{
this.pllogin.visible?=?false;
this.lblname.text?=?session["user"].tostring();
}
?}


?protected?void?btnlogin_click(object?sender,?eventargs?e)
?{
if?(this.txtname.text?==?"l.s.")
{
if?(this.txtpass.text?==?"l.s.")
{
this.lblname.text?=?this.txtname.text;
this.pllogin.visible?=?false;
this.plhello.visible?=?true;
session["user"]?=?"l.s.";
}
else
{
scriptmanager.registerstartupscript(btnlogin,gettype(),?"",?"alert('密码输入错误!')",?true);
}
}
else
{
scriptmanager.registerstartupscript(btnlogin,?gettype(),?"",?"alert('用户名不存在!')",?true);
}
?}
?protected?void?lbout_click(object?sender,?eventargs?e)
?{
session.remove("user");
this.pllogin.visible?=?true;
this.plhello.visible?=?false;
this.txtname.text?=?"";
?}
}
应用母版页的页面

<%@?page?language="c#"?masterpagefile="~/masterpage.master"?autoeventwireup="true"?codefile="default.aspx.cs"?inherits="_default"?title="无标题页"?%>


<asp:content?id="content1"?contentplaceholderid="contentplaceholder1"?runat="server">
say?say?hello!
</asp:content>
输入用户名,密码

登录后

退出后

发表评论 (已有0条评论)

还木有评论哦,快来抢沙发吧~