web应用

来源:百度文库 编辑:神马文学网 时间:2024/04/24 16:29:46
ASP.NET无状态(做状态管理)
Response对象:contentType获得或指定的响应的HTTP内容(MIME)类型为标准的mime类型如text/xml或image/gif 默认的mime类型是text/html
Expires指定浏览器中缓存的页面过期之前的时间
buffer iis缓存
cache asp。net程序缓存,服务器端缓存
redirect重定向
end 结束程序
httpcookie httpcook=new httpcookie("user","abc");
httpcookie.cookies.add(httpcook);
读 request.cookies["user"].value;
cache["username"]="aaa";
response.write(cache["username"]);
response.filter.~过滤不文明的语言
response.Isclientconnected 是否连接
request.rawurl获取当前请求的原始url
response.redirect("~/default.aspx?username=abc");
request.Querystring["username"];//取的值是abc
url比较完整的绝对路径
urlreferrer上次浏览的地址
request.browser 浏览器信息
server.mappath("~/default.aspx")//物理地址
server.HtmlEncode("");编码后为
server.HtmlDecode("");解码后为空
server.Transfer("~/default.aspx");跳转
ispostback 第一次加载时不执行,数据回发在第二次以上 !ispostback
Appliction是asp。net全局对象变量 IIS开着就不会消失,用来网站访问人数,统计流量
Session 会话级别的变量(默认是20分钟可修改)跨请求跨用户,用来保存用户的信息
if (Appliction["count"]!=null)
{
Appliction["count"]=(int)Appliction["count"]+1;
}
else
{
Appliction["count"]=1;
}
session["a"]="b";
默认为按值传递,复制父本数据处理后本身不会变化
ref引用传递 处理后本身会变化
切换到模板绑定用Bind
编译用<%#Eval("")+""%>
可直接在<%#Eval("")+""%>中写
编辑:gvjobs.EditIndex=e.newEditindex;//编译索引
gvjobs.DataBind();
更新:(Textbox)this.gvjobs.rows[e.rowindex].findcontrol("textbox1");
this.gvjobs.rows[e.rowindex].cell[0].text
//分页存储过程
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 @notCountif @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 intif @size<=0
 set @size=10
if @count%@size>0
begin
  set @totalpage=@count/@size+1end
else
begin
   set @totalpage=@count/@sizeend
if @pageIndex<=0
   set @pageIndex=1
if @pageIndex>@totalpage
begin
   set @pageIndex=@totalpageend
set @notCount=@size*(@pageIndex-1)
if @pageIndex<=@totalpage and @pageIndex>=1
 execute('select top '+ @size+' * from '+@tablename +' where '+ @primarykeyname+' not in (select top '+ @notCount+' '+@primarykeyname+' from '+@tablename+' jobs)')go