网站设计 素材专业竞价托管
网站设计 素材,专业竞价托管,百度html代码,2015做哪些网站能致富一、实验内容
1、设计一个用户登录页面webform1.aspx#xff0c;效果如下图所示#xff1a; 2、点击webform1.aspx中“还未注册”连接进入register.aspx#xff0c;注册页面效果如下图所示#xff1a;点击用户注册信息到usershow.aspx页面#xff0c;并显示注册的用户信息…一、实验内容
1、设计一个用户登录页面webform1.aspx效果如下图所示 2、点击webform1.aspx中“还未注册”连接进入register.aspx注册页面效果如下图所示点击用户注册信息到usershow.aspx页面并显示注册的用户信息。 3、用户分别使用admin和user账户登录系统分别进入admin.aspx和user.aspx页面并采用session方法设计权限控制避免用户通过链接直接访问admin.aspx与user.aspx页面。
4、点击webform1.aspx页面中“记住我”复选框实现用户免登录功能。如将“记住我”复选框修改为如下图所示修改并实现其功能。 二、代码实现 这是个实验我就一节课做了一点点内容就暂时存一下我目前的进度对于session和cookie相关的知识点我还是不太能正确使用所以在重新学习一遍之后再继续完善题目的要求吧。目前的内容代码如下
webform1.aspx代码
% Page LanguageC# AutoEventWireuptrue CodeBehindWebForm1.aspx.cs InheritsWebApplication2.WebForm1 %!DOCTYPE htmlhtml xmlnshttp://www.w3.org/1999/xhtml
head runatserver
meta http-equivContent-Type contenttext/html; charsetutf-8/title/titlelink relstylesheet hrefStyleSheet1.css/style typetext/css.auto-style1 {width: 100%;height: 80px;}.auto-style2 {width: 494px;}.auto-style3 {margin-left: 0px;}.auto-style4 {height: 403px;}/style
/head
bodyform idform1 runatserverdivbr /div idlogindiv idtop classauto-style4h1nbsp;/h1h1用户登录/h1pnbsp;/ptable classauto-style1trtd classauto-style2asp:TextBox IDTextBox1 runatserver CssClasstxt1 ForeColorSilver用户名/asp:TextBox/td/trtrtd classauto-style2asp:TextBox IDTextBox2 runatserver CssClasstxt1 ForeColorSilver密码/asp:TextBox/td/tr/tablepnbsp;/ppasp:CheckBox IDCheckBox1 runatserver CssClasstxt1 Text记住我 OnCheckedChangedCheckBox1_CheckedChanged //ppasp:Button IDButton1 runatserver CssClassauto-style3 Height50px OnClickButton1_Click Text登录 Width210px BackColor#337AB7 //ppnbsp;asp:LinkButton IDLinkButton1 runatserver OnClickLinkButton1_Click还未注册/asp:LinkButton
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;asp:LinkButton IDLinkButton2 runatserver忘记密码/asp:LinkButton/pbr /br //div/div/div/form
/body
/htmlstylesheet1.css代码
body {margin: 80px auto;background-color: #9CBE74;
}
#login{background-color:white;height:500px;width:500px;border:1px solid black;margin:auto;}
#login table{height:90px;width:500px;margin:auto;}
#top {height: 400px;width: 500px;text-align: center;margin:auto;
}.txt1{height:40px;width:350px;
}
webform1.aspx.cs代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;namespace WebApplication2
{public partial class WebForm1 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void LinkButton1_Click(object sender, EventArgs e){Response.Redirect(register.aspx);}protected void Button1_Click(object sender, EventArgs e){if (TextBox1.Text admin TextBox2.Text 123){Session[user] admin;Response.Redirect(admin.aspx);}else if (TextBox1.Text User TextBox2.Text 1234){Session[user] User;Response.Redirect(user.aspx);}else{Response.Write(scriptalert(账号或密码错误);/script);}}}
}
register.aspx代码
% Page LanguageC# AutoEventWireuptrue CodeBehindregister.aspx.cs InheritsWebApplication2.register %!DOCTYPE htmlhtml xmlnshttp://www.w3.org/1999/xhtml
head runatserver
meta http-equivContent-Type contenttext/html; charsetutf-8/title/titlelink relstylesheet hrefStyleSheet2.css/style typetext/css.auto-style1 {width: 80%;height: 150px;}.auto-style4 {width: 100%;}.auto-style5 {width: 141px;}.auto-style6 {width: 141px;height: 60px;}.auto-style7 {height: 60px;}/style
/head
bodyform idform1 runatserver methodpost actionusershow.aspxdivdiv idlogin2h1nbsp;/h1h1用户注册页面/h1hr /div idxinxibr /table classauto-style1trtd colspan1table classauto-style4trtd classauto-style6用户名/tdtd classauto-style7asp:TextBox IDTextBox6 runatserver CssClasstxt ForeColorSilver请输入用户名/asp:TextBox/td/trtrtd classauto-style5密码/tdtdasp:TextBox IDTextBox7 runatserver CssClasstxt ForeColorSilver请输入密码/asp:TextBox/td/trtrtd classauto-style5确认/tdtdasp:TextBox IDTextBox8 runatserver CssClasstxt ForeColorSilver请再次输入密码/asp:TextBox/td/trtrtd classauto-style5姓名/tdtdasp:TextBox IDTextBox9 runatserver CssClasstxt ForeColorSilver请输入真实姓名/asp:TextBox/td/trtrtd classauto-style5邮箱/tdtdasp:TextBox IDTextBox10 runatserver CssClasstxt ForeColorSilver请输入电子邮箱/asp:TextBox/tr/tablebr /asp:Button IDButton1 runatserver Height44px Text提交注册 Width125px //td/tr/table/div/div/div/form
/body
/htmlregister.aspx.cs代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;namespace WebApplication2
{public partial class register : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){Response.Redirect(usershow.aspx);}}
}
stylesheet2.css代码
body {background-color:darkgray;
}
#login2{background-color:white;height:550px;width:600px;border:1px solid black;margin:30px auto;text-align:center;
}#login2 h1 {color:cornflowerblue;}#login2 hr {height: 2px;width: 580px;margin: auto;color: cornflowerblue;}
#login2 table{margin:0px auto;height:250px;width:500px;
}
.txt {height: 20px;width: 300px;
}
usershow.aspx代码
% Page LanguageC# AutoEventWireuptrue CodeBehindusershow.aspx.cs InheritsWebApplication2.usershow %!DOCTYPE htmlhtml xmlnshttp://www.w3.org/1999/xhtml
head runatserver
meta http-equivContent-Type contenttext/html; charsetutf-8/title/title
/head
bodyform idform1 runatserverdivbr /所要注册的用户信息br /br /br /用户名asp:Label IDLabel1 runatserver TextLabel/asp:Labelbr /br /密码asp:Label IDLabel2 runatserver TextLabel/asp:Labelbr /br /确认密码asp:Label IDLabel3 runatserver TextLabel/asp:Labelbr /br /姓名asp:Label IDLabel4 runatserver TextLabel/asp:Labelbr /br /邮箱asp:Label IDLabel5 runatserver TextLabel/asp:Label/div/form
/body
/htmlusershow.aspx.cs代码(注意这里使用的是request的post方法所以需要在register.aspx源代码中添加相应的代码
)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;namespace WebApplication2
{public partial class usershow : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){Label1.Text Request.Form[TextBox6];Label2.Text Request.Form[TextBox7];Label3.Text Request.Form[TextBox8];Label4.Text Request.Form[TextBox9];Label5.Text Request.Form[TextBox10];}}
}
然后就是新建了两个网页admin.aspx和user.aspx但是里面的内容只有一句话所以就不贴出来了后面完善之后再贴。
三、完成结果演示 当随便输入用户名和密码时
会出现一个弹窗输出账号或密码错误 当输入用户名为admin密码为123时则会进入admin页面 用户名为user而密码为1234时进入user界面 当点击还未注册则进入注册页面这里缺少注册信息的限制以及相应的验证控件
提交注册之后会显示当前需要注册的用户信息
暂时就完成了这些内容。后面继续补充吧。 虽然感觉自己整节课都很忙但是这么总结一下感觉也没有做出来多少东西就只是模模糊糊的完成了前三个要求后面的cookie我刚才尝试了一下无法得到要求所以再学习一下再补充吧。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/91705.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!