如下:
string fullpath = context.Server.MapPath("hello.htm"); //得到hello.htm的全路径 string content = System.IO.File.ReadAllText(); //读入文件内容 context.Response.Write(content); //将hello.htm的内容打出来 string username = context.Request["UserName"]; //获得URL中UserName参数的值 if (string.IsNullOrEmpty(username)) //判断是否有值 { context.Response.Write("直接进入"); }else{ context.Response.Write("提交进入"); }