ASP.NET無(wú)狀態(tài)(做狀態(tài)管理)
Response對(duì)象:contentType獲得或指定的響應(yīng)的HTTP內(nèi)容(MIME)類(lèi)型為標(biāo)準(zhǔn)的mime類(lèi)型如text/xml或image/gif 默認(rèn)的mime類(lèi)型是text/html
Expires指定瀏覽器中緩存的頁(yè)面過(guò)期之前的時(shí)間
buffer iis緩存
cache asp。net程序緩存,服務(wù)器端緩存
redirect重定向
end 結(jié)束程序
httpcookie httpcook=new httpcookie("user","abc");
httpcookie.cookies.add(httpcook);
讀 request.cookies["user"].value;
cache["username"]="aaa";
response.write(cache["username"]);
response.filter.~過(guò)濾不文明的語(yǔ)言
response.Isclientconnected 是否連接
request.rawurl獲取當(dāng)前請(qǐng)求的原始url
response.redirect("~/default.aspx?username=abc");
request.Querystring["username"];//取的值是abc
url比較完整的絕對(duì)路徑
urlreferrer上次瀏覽的地址
request.browser 瀏覽器信息
server.mappath("~/default.aspx")//物理地址
server.HtmlEncode("<Html>");編碼后為<Html>
server.HtmlDecode("<Html>");解碼后為空
server.Transfer("~/default.aspx");跳轉(zhuǎn)
ispostback 第一次加載時(shí)不執(zhí)行,數(shù)據(jù)回發(fā)在第二次以上 !ispostback
Appliction是asp。net全局對(duì)象變量 IIS開(kāi)著就不會(huì)消失,用來(lái)網(wǎng)站訪問(wèn)人數(shù),統(tǒng)計(jì)流量
Session 會(huì)話(huà)級(jí)別的變量(默認(rèn)是20分鐘可修改)跨請(qǐng)求跨用戶(hù),用來(lái)保存用戶(hù)的信息
if (Appliction["count"]!=null)
{
Appliction["count"]=(int)Appliction["count"]+1;
}
else
{
Appliction["count"]=1;
}
session["a"]="b";
默認(rèn)為按值傳遞,復(fù)制父本數(shù)據(jù)處理后本身不會(huì)變化
ref引用傳遞 處理后本身會(huì)變化
切換到模板綁定用Bind
編譯用<%#Eval("")+""%>
可直接在<Item~><%#Eval("")+""%></Item~>中寫(xiě)
編輯:gvjobs.EditIndex=e.newEditindex;//編譯索引
gvjobs.DataBind();
更新:(Textbox)this.gvjobs.rows[e.rowindex].findcontrol("textbox1");
this.gvjobs.rows[e.rowindex].cell[0].text
//分頁(yè)存儲(chǔ)過(guò)程
declare @size int
declare @pageIndex int
declare @notCount int
declare @count int
declare @totalpage int
set @pageIndex=113
set @size=4
select @count=count(job_id) from jobs
print(@count)
if @count%@size>0
begin
set @totalpage=@count/@size+1
print @totalpage
end
else
begin
set @totalpage=@count/@size
print(@totalpage)
end
if @pageIndex<=0
set @pageIndex=1
if @pageIndex>@totalpage
begin
set @pageIndex=@totalpage-1
print @pageIndex
end
set @notCount=@size*@pageIndex
print @notCount
if @pageIndex<
=@totalpage and @pageIndex>=1
execute('select top '+ @size+' * from jobs where job_id not in (select top '+ @notCount+' job_id from jobs)')
declare @count int
select @count=count(emp_id) from employee
exec sp_pager 10000,-100,@count,'employee','emp_id'
alter procedure sp_pager
@size int,
@pageIndex int,
@count int,
@tablename varchar(50),
@primarykeyname varchar(50)
as
declare @notCount int
declare @totalpage int
if @size<=0
set @size=10
if @count%@size>0
begin
set @totalpage=@count/@size+1
end
else
begin
set @totalpage=@count/@size
end
if @pageIndex<=0
set @pageIndex=1
if @pageIndex>@totalpage
begin
set @pageIndex=@totalpage
end
set @notCount=@size*(@pageIndex-1)
go