找回密码
 会员注册
查看: 152|回复: 0

asp实现注册登录界面_asp.net 实现用户登录和注册——基于webform模式

[复制链接]

1389

主题

5

回帖

496万

积分

管理员

积分
4962988
发表于 2024-2-29 08:49:12 | 显示全部楼层 |阅读模式
cf218941abcdcbf398fe5b199406fb5e.gif
点击上方蓝色字体,关注我们

   环境:Windows10 + VS2015 + 自带LocalDB

    看一下效果:

    1、注册页面:

1462f56a1e8189445a71c6d11c2c8676.png

如果用户重名:

cc206ff9594e0719550fe567d4299d35.png

2、登录页:

f334efac0c5e1ddd10fe74c8f26095ab.png

3、注册或者登录好了会跳到Home页面并且显示当前的用户

下面看看关键代码:

①注册前台页面Register.aspx:

[code][/code]

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="Album.OnlineAlbum.Register" %>

span style="box-sizing: border-box;outline: 0px;overflow-wrap: break-word;">html>

注册title></p> <p><style></p> <p> form{ </p> <p>color:#575454;</p> <p>width:500px;</p> <p>margin:20px auto;</p> <p>font-size:15px;</p> <p> }</p> <p>.label{ </p> <p>color:red;</p> <p>font-size:12px;</p> <p>font-family:'Lucida Console';</p> <p>}</p> <p>input.Tb{ </p> <p>border-radius:5px;</p> <p>}</p> <p>.user_name{ width:240px; height:38px; line-height:38px; border:1px solid #000; background:url(login_img_03.png) no-repeat left center; padding-left:30px; }</p> <p>.user_name input{ width:230px; height:36px; border:1px solid #fff;color:#666;}</p> <p>.password{ width:240px; height:38px; line-height:38px; border:1px solid #dfe1e8; background:url(login_img_09.png) no-repeat left center; padding-left:30px; }</p> <p>.password input{ width:230px; height:36px; border:1px solid #000;color:#666;}</p> <p>.transButton { </p> <p>border:solid 1px;</p> <p>background-color:transparent;</p> <p>}</p> <p>#btnRegister{ </p> <p>font-size:14px;</p> <p>}</p> <p>#linkToLogin{ </p> <p>text-decoration:none</p> <p>}</p> <p>#ckItem{ </p> <p>text-decoration:none</p> <p>}</p> <p>body{ </p> <p>background-image:url("rbg.jpg");</p> <p>}</p> <p>style></p> <p>head></p> <p><body></p> <p><form id="form1" runat="server"></p> <p><h2>欢迎注册OAh2></p> <p><h3>每一天,记录美。h3></p> <p><br /></p> <p><asp:ScriptManager ID="ScriptManager1" runat="server"></p> <p>asp:ScriptManager></p> <p><asp:TextBox runat="server" ID="rUserNameText" Height="40px" Width="490px" CssClass="Tb">asp:TextBox></p> <p><br /></p> <p><asp:UpdatePanel ID="UpdatePanel1" runat="server"></p> <p><ContentTemplate></p> <p><asp:CustomValidator ID="CustomValidator1" runat="server" </p> <p>ControlToValidate="rUserNameText" ErrorMessage="*"</p> <p>onservervalidate="CustomValidator1_ServerValidate"></p> <p>asp:CustomValidator></p> <p>ContentTemplate></p> <p>asp:UpdatePanel></p> <p><br /></p> <p><asp:TextBox runat="server" ID="rPsdText" TextMode="Password" Height="40px" Width="490px" CssClass="Tb">asp:TextBox></p> <p><br /></p> <p><asp:UpdatePanel ID="UpdatePanel2" runat="server"></p> <p><ContentTemplate></p> <p><asp:CustomValidator ID="CustomValidator2" runat="server" </p> <p>ControlToValidate="rPsdText" ErrorMessage="*"</p> <p>onservervalidate="CustomValidator2_ServerValidate"></p> <p>asp:CustomValidator></p> <p>ContentTemplate></p> <p>asp:UpdatePanel></p> <p><br /></p> <p><asp:TextBox runat="server" ID="rrPsdText" TextMode="Password" Height="40px" Width="490px" CssClass="Tb" >asp:TextBox></p> <p><br /></p> <p><asp:UpdatePanel ID="UpdatePanel3" runat="server"></p> <p><ContentTemplate></p> <p><asp:CustomValidator ID="CustomValidator3" runat="server" </p> <p>ControlToValidate="rrPsdTe</p><br>来源:<a href="https://blog.csdn.net/weixin_39946274/article/details/109908712" target="_blank">https://blog.csdn.net/weixin_39946274/article/details/109908712</a><br>免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!</td></tr></table> <div class="attach_nopermission attach_tips"> <div> <h3><strong>本帖子中包含更多资源</strong></h3> <p>您需要 <a href="member.php?mod=logging&action=login" onclick="showWindow('login', this.href);return false;">登录</a> 才可以下载或查看,没有账号?<a href="member.php?mod=registercorfly" title="注册账号">会员注册</a> </p> </div> <span class="atips_close" onclick="this.parentNode.style.display='none'">×</span> </div> </div> <div id="comment_3613" class="cm"> </div> <div id="post_rate_div_3613"></div> </div> </div> </td></tr> <tr><td class="plc plm"> </td> </tr> <tr id="_postposition3613"></tr> <tr> <td class="pls"></td> <td class="plc" style="overflow:visible;"> <div class="po hin"> <div class="pob cl"> <em> <a class="fastre" href="forum.php?mod=post&action=reply&fid=60&tid=2454&reppost=3613&extra=&page=1" onclick="showWindow('reply', this.href)">回复</a> </em> <p> <a href="javascript:;" id="mgc_post_3613" onmouseover="showMenu(this.id)" class="showmenu">使用道具</a> <a href="javascript:;" onclick="showWindow('miscreport3613', 'misc.php?mod=report&rtype=post&rid=3613&tid=2454&fid=60', 'get', -1);return false;">举报</a> </p> <ul id="mgc_post_3613_menu" class="p_pop mgcmn" style="display: none;"> </ul> <script type="text/javascript" reload="1">checkmgcmn('post_3613')</script> </div> </div> </td> </tr> <tr class="ad"> <td class="pls"> </td> <td class="plc"> </td> </tr> </table> </div><div id="postlistreply" class="pl"><div id="post_new" class="viewthread_table" style="display: none"></div></div> </div> <form method="post" autocomplete="off" name="modactions" id="modactions"> <input type="hidden" name="formhash" value="c5a8284d" /> <input type="hidden" name="optgroup" /> <input type="hidden" name="operation" /> <input type="hidden" name="listextra" value="" /> <input type="hidden" name="page" value="1" /> </form> <div class="pgs mtm mbm cl"> <span class="pgb y"><a href="forum-60-1.html">返回列表</a></span> <a id="newspecialtmp" onmouseover="$('newspecial').id = 'newspecialtmp';this.id = 'newspecial';showMenu({'ctrlid':this.id})" onclick="showWindow('newthread', 'forum.php?mod=post&action=newthread&fid=60')" href="javascript:;" title="发新帖" class="pgsbtn showmenu">发新帖</a> </div> <!--[diy=diyfastposttop]--><div id="diyfastposttop" class="area"></div><!--[/diy]--> <script type="text/javascript"> var postminchars = parseInt('30'); var postmaxchars = parseInt('10000'); var postminsubjectchars = parseInt('1'); var postmaxsubjectchars = parseInt('80'); var disablepostctrl = parseInt('0'); </script> <div id="f_pst" class="pl bm bmw"> <form method="post" autocomplete="off" id="fastpostform" action="forum.php?mod=post&action=reply&fid=60&tid=2454&extra=&replysubmit=yes&infloat=yes&handlekey=fastpost" onSubmit="return fastpostvalidate(this)"> <table cellspacing="0" cellpadding="0"> <tr> <td class="pls"> </td> <td class="plc"> <span id="fastpostreturn"></span> <div class="cl"> <div id="fastsmiliesdiv" class="y"><div id="fastsmiliesdiv_data"><div id="fastsmilies"></div></div></div><div class="hasfsl" id="fastposteditor"> <div class="tedt mtn"> <div class="bar"> <span class="y"> <a href="forum.php?mod=post&action=reply&fid=60&tid=2454" onclick="return switchAdvanceMode(this.href)">高级模式</a> </span><script src="static/js/seditor.js?I08" type="text/javascript"></script> <div class="fpd"> <a href="javascript:;" title="文字加粗" class="fbld">B</a> <a href="javascript:;" title="设置文字颜色" class="fclr" id="fastpostforecolor">Color</a> <a id="fastpostimg" href="javascript:;" title="图片" class="fmg">Image</a> <a id="fastposturl" href="javascript:;" title="添加链接" class="flnk">Link</a> <a id="fastpostquote" href="javascript:;" title="引用" class="fqt">Quote</a> <a id="fastpostcode" href="javascript:;" title="代码" class="fcd">Code</a> <a href="javascript:;" class="fsml" id="fastpostsml">Smilies</a> </div></div> <div class="area"> <div class="pt hm"> 您需要登录后才可以回帖 <a href="member.php?mod=logging&action=login" onclick="showWindow('login', this.href)" class="xi2">登录</a> | <a href="member.php?mod=registercorfly" class="xi2">会员注册</a> </div> </div> </div> </div> </div> <div id="seccheck_fastpost"> </div> <input type="hidden" name="formhash" value="c5a8284d" /> <input type="hidden" name="usesig" value="" /> <input type="hidden" name="subject" value=" " /> <p class="ptm pnpost"> <a href="home.php?mod=spacecp&ac=credit&op=rule&fid=60" class="y" target="_blank">本版积分规则</a> <button type="button" onclick="showWindow('login', 'member.php?mod=logging&action=login&guestmessage=yes')" onmouseover="checkpostrule('seccheck_fastpost', 'ac=reply');this.onmouseover=null" name="replysubmit" id="fastpostsubmit" class="pn pnc vm" value="replysubmit"><strong>发表回复</strong></button> <label class="lb"><input type="checkbox" name="adddynamic" class="pc" value="1" />回帖并转播</label> <label for="fastpostrefresh"><input id="fastpostrefresh" type="checkbox" class="pc" />回帖后跳转到最后一页</label> <script type="text/javascript">if(getcookie('fastpostrefresh') == 1) {$('fastpostrefresh').checked=true;}</script> </p> </td> </tr> </table> </form> </div> </div> <div class="wp mtn"> <!--[diy=diy3]--><div id="diy3" class="area"></div><!--[/diy]--> </div> <script type="text/javascript"> function succeedhandle_followmod(url, msg, values) { var fObj = $('followmod_'+values['fuid']); if(values['type'] == 'add') { fObj.innerHTML = '不收听'; fObj.href = 'home.php?mod=spacecp&ac=follow&op=del&fuid='+values['fuid']; } else if(values['type'] == 'del') { fObj.innerHTML = '收听TA'; fObj.href = 'home.php?mod=spacecp&ac=follow&op=add&hash=c5a8284d&fuid='+values['fuid']; } } fixed_avatar([3613], 1); </script> </div> <div id="ft" class="wp cl"> <div id="flk" class="y"> <p> <a href="//wpa.qq.com/msgrd?v=3&uin=516734115&site=心飞设计-网站,自媒体设计软件技术分享。新手站长乐园&menu=yes&from=discuz" target="_blank" title="QQ"><img src="static/image/common/site_qq.jpg" alt="QQ" /></a><span class="pipe">|</span><a href="forum.php?showmobile=yes" >手机版</a><span class="pipe">|</span><strong><a href="http://www.corfly.com" target="_blank">心飞设计-版权所有:微度网络信息技术服务中心</a></strong> ( <a href="https://beian.miit.gov.cn/" target="_blank">鲁ICP备17032091号-12</a> )<span class="pipe">|</span><a href="data/sitemap.xml" target="_blank" title="网站地图">网站地图</a><script type="text/javascript" src="//api.tongjiniao.com/c?_=631452074556137472" async></script></p> <p class="xs0"> GMT+8, 2024-12-25 13:39<span id="debuginfo"> , Processed in 0.445237 second(s), 27 queries . </span> </p> </div> <div id="frt"> <p>Powered by <strong><a href="https://www.discuz.vip/" target="_blank">Discuz!</a></strong> <em>X3.5</em></p> <p class="xs0">© 2001-2024 <a href="https://code.dismall.com/" target="_blank">Discuz! Team</a>.</p> </div></div> <script src="home.php?mod=misc&ac=sendmail&rand=1735105197" type="text/javascript"></script> <div id="scrolltop"> <span><a href="forum.php?mod=post&action=reply&fid=60&tid=2454&extra=&page=1" onclick="showWindow('reply', this.href)" class="replyfast" title="快速回复"><b>快速回复</b></a></span> <span hidefocus="true"><a title="返回顶部" onclick="window.scrollTo('0','0')" class="scrolltopa" ><b>返回顶部</b></a></span> <span> <a href="forum-60-1.html" hidefocus="true" class="returnlist" title="返回列表"><b>返回列表</b></a> </span> </div> <script type="text/javascript">_attachEvent(window, 'scroll', function () { showTopLink(); });checkBlind();</script> </body> </html>