元素的ID值是给DOM用的,NAME值是给服务器用的.
获取文件在服务器的路径:
string fullPath = context.Server.MapPath("Hello2.htm");
读取文件内容:
string content = System.IO.File.ReadAllText(fullPath);
判断字符串是否为空或空值:
string.IsNullOrEmpty(username);
隐藏字段:
<input type="hidden" name="ispostback" value="true" />
只有设定了name的input、textarer、select的value属性值才会被提交给服务器。
在aspx的Page指令区加上EnableViewState="false".内网系统,互联网的后台可以心情的用ViewState.
写入Cookie:
Response.SetCookie(new HttpCookie("Color",TextBox1.Text));
读取Cookie:
Label1.Text = Request.Cookies["Color"].Value;
ashx调用Session:
要继承:IRequiresSessionState这个类;
写入Session:
Session["第一个值"] = DateTime.Now;
Session["第二个值"] = 300;
读取Session:
Button2.Text = Convert.ToString(Session["第一个值"]) + Session["第二个值"];
1383

被折叠的 条评论
为什么被折叠?



