悬赏园豆:10
[已关闭问题]
<P>现在用的开发框架是monorail,今天发现自己写的cookie操作类有问题,后来发现直接用HttpContext.Current仍然有问题,代码如下,请大家帮忙看一下,谢谢!</P>
<P> HttpContext hc = HttpContext.Current;<BR> HttpResponse res = hc.Response;<BR> HttpRequest req = hc.Request;</P>
<P> res.SetCookie(new HttpCookie("test2", "123"));<BR> Response.Write(req.Cookies["test2"].Value.ToString() + "<br />");<BR> res.SetCookie(new HttpCookie("test2", "456"));<BR> Response.Write(req.Cookies["test2"].Value.ToString() + "<br />");<BR> res.SetCookie(new HttpCookie("test2", "789"));<BR> Response.Write(req.Cookies["test2"].Value.ToString() + "<br />");</P>
<P> 按我的理解,输出结果应该是 123 456 789,但是实际的输出结果确是 789 789 789。</P>
<P>用webform的response和request试了一下,结果是正确的,请问上边这段代码错在哪了呢?</P>
且歌
|
初学一级
|
园豆:
170
提问于:2008-05-12 15:10