public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/html"; string strPath = context.Server.MapPath("hello2.htm"); //获取文件的路径 context.Response.Write(strPath); //输出路径 string strContents = System.IO.File.ReadAllText(strPath);//获取文件的内容 context.Response.Write(strContents); //输出一个网页 string strUserName = context.Request["txtUserName"]; //获取用户名 if (string.IsNullOrEmpty(strUserName)) //判断是否存在用户名 { context.Response.Write("直接进入 --welcome, " + strUserName); } else { context.Response.Write("提交进入 --welcome, " + strUserName); } }