您的位置:首页 > 其它

咖啡好苦,如同生活

2007-09-23 17:59 281 查看
刚喝了一口咖啡,真苦!
就像生活一样,连心都是苦的。虽然有人说咖啡很不错,可那只是对于适合他的人来说。
在一个地方呆久了,心里也会像咖啡一样苦。

把我今天上午学习的结果粘出来。
aspx页:(其cs页面无任何代码)

1
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" >
6<head runat="server">
7 <title>无标题页</title>
8</head>
9<body>
10 <form id="form1" runat="server">
11 <div>
12 <asp:ScriptManager ID="ScriptManager1" runat="server">
13 </asp:ScriptManager>
14
15 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
16 <ContentTemplate>
17 <%=DateTime.Now %>
18 <br />
19 <asp:TextBox TextMode="multiLine" ID="txtContent" Rows="5" Columns="4" runat="server" />
20 <asp:Button ID="Button1" runat="server" Text="Refresh" />
21 </ContentTemplate>
22 </asp:UpdatePanel>
23
24 <input type="button" onclick="sendRequest('normal');" value="Normal" />
25 <input type="button" onclick="sendRequest('error');" value="Error" />
26 <input type="button" onclick="sendRequest('timeout');" value="TimeOut" />
27 <input type="button" onclick="try{webRequest.get_executor().abort();}catch(e){alert(e.message+'\n请先单击timeout按钮,并在3秒钟内单击此按钮');}" value="abort" />
28
29 </div>
95 </form>
96</body>
97</html>
98

Handler.ashx页:

1<%@ WebHandler Language="C#" Class="Handler" %>
2
3using System;
4using System.Web;
5
6public class Handler : IHttpHandler
8 public void ProcessRequest (HttpContext context) context.Response.ContentType = "text/plain";
10 string action = context.Request.Headers["action"].ToString();
11
12 switch (action)
13 case "error":
15 throw new Exception();
16 break;
17 case "normal":
18 //for (int i = 0; i < context.Request.ServerVariables.Count; i++)
19 //{
20 // context.Response.Write(context.Request.ServerVariables.Keys[i] + "=" + context.Request.ServerVariables[i].ToString() + "\n");
21 //}
22 context.Response.Write("发送请求的网页URL:" + context.Request.ServerVariables["HTTP_REFERER"]);
23 context.Response.Write("\n发送过来的数据是:" + context.Request.Form["data"].ToString());
24 break;
25 case "timeout":
26 System.Threading.Thread.Sleep(5000);
27 break;
28 default:
29 context.Response.Write("非法的请求!");
30 break;
31 }
32 }
33
34 public bool IsReusable get return false;
37 }
38 }
39
40}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: