html客户端服务器控件[今天上课一直不在状态,好困啊!zzzZZZZZZ]

1.静态网站:html——超文本标记语言
2.动态网站:网页上的网页要和服务器交互
  http----超文本传输协议

1.website
2.webApplication
区别:website是针对用户的,webApplication是针对于开发人员、更利于开发。

aspx
aspx.cs : 里是用C#写的代码

新建一个空网站——添加新建项[html/一般处理程序]
html:
<form cation="Handler.ashx">
<input type="hidden" name="fanhui" value="fanhuile"/>
姓名:<input type="text" name="UserName" value=""/>
<input type="submit"  value="submit"/>
</form>

一般处理程序:
context.Response.ContenType="text/html";
string username=context.Request["UserName"];
string fh=context.Request["fanhui"];
string fullPath=context.Server.MapPath("HTMLPage.htm");
string htmlShow=System.IO.File.ReadAllText(fullPath);
if(fh=="fanhuile")
{
context.Response.Write("提交进入");
}
else
{
context.Response.Write("直接进入");
username="";
}
htmlshow=htmlShow.Replace("@value",username);
context.Response.Write(htmlShow);


二、html客户端服务器控件

1. html控件,不去检查正确性,无法在服务器端进行处理
2.aspx服务器控件,runat="server"
3.html客户端服务器控件——标签
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
注释:<%-- --%>

哪些标签可以使用服务端【服务端控件】:加runat="server"
1.表格:<td></td>同理<table></table>也是服务端控件
2.超链接:<a></a>
3.可以自己定义服务端控件
Inner内连接 htmlControls这个类下的htmlInput、htmlTableCell、htmlAnchor、

htmlGenericContril
Generic---一般的
4.<div></div>
<label></label>

读文本文件:
string[] lines=File.ReadAllLines("password.txt");
string username=textUserName.Value;
string password=passwordTxt.Value;
for(int i=0;i<lines.Length;i++)
{
string[] line=lines[i].Split('');
if(username==line[0]&&password==line[1])
{
htmlLabel1.InnerText="登陆成功"
}
}
htmlLabel1.InnerText="登陆失败"


添加wed窗体
<style type="text/css">
.table
{
margin:0 autto;
width:50%;
border:1px double green;
}
</style>

<table class="table">
<tr><td>用户名</td><input type="text" id="UserNameTet"runat="server"/></tr>

</table>

 

你可能感兴趣的:(html客户端服务器控件[今天上课一直不在状态,好困啊!zzzZZZZZZ])