迷失网络

如果你误读成“迷失公园”或“迷失侏罗纪”,那你可能真的迷失网络了。
随笔 - 88, 评论 - 1932, 引用 - 106

导航

关于

lostinet@lostinet.com这个油箱不能用了。因为空间没了,lostinet.com指向为127.0.0.1 。。。

标签

每月存档

最新留言

广告

 

我想由不少人都懂得在Applicaton_Start等事件中使用HttpContext.RewritePath来改变HttpHandler。

如果在 Server.Transfer/Execute 的调用前,使用RewritePath,更可以起到指定QueryString的效果。

例如

Context.RewritePath("AA.Aspx","","OKOK=3333");
Context.Server.Transfer("Test2.Aspx");

这样,就能执行Test2.Aspx,并且QueryString是OKOK=3333。

这个用途特别大。我目前用这个方法来避免使用 Response.Redirect 。

打印 | 张贴于 2004-08-21 02:25:00 | Tag:DotNet  AspNet

留言反馈

#回复: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
很漂亮啊。HttpContext.Current也很有用。
2008-02-10 01:59:00 | [匿名用户:在线代理]
#如何使用HttpContext对象 编辑
今天看了一篇文章,ASP.NET保持用户状态的九种选择,其上有一些关于HttpContext的介绍:保持单个用户、单个请求的数据,并且数据只在该请求期间保持。被提供用于保持需要在不同的HttpModu...
2007-12-11 21:31:00 | [匿名用户:雷明]
#如何使用HttpContext对象 编辑
今天看了一篇文章,ASP.NET保持用户状态的九种选择,其上有一些关于HttpContext的介绍:保持单个用户、单个请求的数据,并且数据只在该请求期间保持。被提供用于保持需要在不同的HttpModu...
2007-12-11 21:30:00 | [匿名用户:雷明]
#如何使用HttpContext对象 编辑
今天看了一篇文章,ASP.NET保持用户状态的九种选择,其上有一些关于HttpContext的介绍:保持单个用户、单个请求的数据,并且数据只在该请求期间保持。被提供用于保持需要在不同的HttpModu...
2007-12-11 21:30:00 | [匿名用户:雷明]
#如何使用HttpContext对象 编辑
今天看了一篇文章,ASP.NET保持用户状态的九种选择,其上有一些关于HttpContext的介绍:保持单个用户、单个请求的数据,并且数据只在该请求期间保持。被提供用于保持需要在不同的HttpModu...
2007-12-11 21:30:00 | [匿名用户:雷明]
#不错 编辑
学习,不是广告。
就是想灌点水。
2007-01-05 16:08:00 | [匿名用户:王计平]
#不错 编辑
学习
2007-01-05 16:07:00 | [匿名用户:王计平]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
Help:
现在有2个虚拟目录A和B
A下的文件afile想定位到B下的文件bfile
不想用response.redirect
可是server.transfer("../B/bfile")也出错
Please mail to star-fire@263.net
2005-12-22 09:20:00 | [匿名用户:lift]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑

有什么差别?
2005-05-18 23:54:00 | [匿名用户:科技]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
Context.RewritePath("AA.Aspx","","OKOK=3333");
Context.Server.Transfer("Test2.Aspx");




Context.Server.Transfer("Test2.Aspx?OKOK=3333");


有什么差别?
2005-04-25 11:22:00 | [匿名用户:xiao]
#re:使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
^_^,Pretty Good!
2005-04-15 20:00:00 | [匿名用户:界面张力仪]
#re:使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
^_^,Pretty Good!
2005-04-10 19:45:00 | [匿名用户:细胞破碎仪]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
不是太明白,能举点例子吗?
2005-04-03 21:05:00 | [匿名用户:look]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
Context.RewritePath("AA.Aspx","","OKOK=3333");
Context.Server.Transfer("Test2.Aspx");




Context.Server.Transfer("Test2.Aspx?OKOK=3333");


有什么差别?
2005-03-22 21:53:00 | [匿名用户:egg]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
在Applicaton_Start等事件中使用HttpContext.RewritePath来改变HttpHandler


这个我倒是不懂
2005-03-22 21:46:00 | [匿名用户:henry]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
Context.Server.Transfer("Test2.Aspx");
直接使用Transfer也能传SQ值啊
2005-03-22 13:14:00 | [匿名用户:zero]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
看不懂
2005-03-16 15:54:00 | [匿名用户:思念]
#HttpContext对象和RewritePath方法 编辑
Ping Back来自:www.donews.net
2005-03-09 23:50:00 | [匿名用户:阿力]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
2004-12-04 11:05:00 | [匿名用户:jbbjcc]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
2004-12-04 11:05:00 | [匿名用户:jbbjcc]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
Context.Server.Transfer is much faster than Response.Redirect
2004-10-07 06:30:00 | [匿名用户:newer]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
请问为什么要避免Response.Redirect 啊?:-)
2004-09-22 11:03:00 | [匿名用户:blestpc]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
看明白了。。嘿嘿
2004-09-10 03:25:00 | [匿名用户:klete]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
例子太不清楚。
2004-09-10 03:19:00 | [匿名用户:klete]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
不错,可以用!
2004-09-01 19:29:00 | [匿名用户:Google排名]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
Context.RewritePath("AA.Aspx","","OKOK=3333"); 这个里面的AAj.aspx是任意指定的嘛?
2004-08-21 16:03:00 | [匿名用户:清风]
#re: 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute 编辑
这个用途我发现了,还发现了两个现象:

1 在HttpContext.Current无法使用HttpSession对象。
我试验了许多种方法,都不行。

2 还是在HttpContext.Current里面的Handler属性可以让你直接控制当前的Page。
即:
System.Web.UI.Page page = (System.Web.UI.Page)HttpContext.Current.Handler;
是可以的,而且可以利用这个直接控制Page的内容和行为。
2004-08-21 09:14:00 | [匿名用户:笑望人生]
对不起,目前本随笔不允许发表新评论.

Powered by: Joycode.MVC引擎 0.5.1.0