---------------------- Windows Phone 7手机开发、.Net培训、期待与您交流! ----------------------
下面是杨中科的视频的讲解代码:
html的代码:
<html>
<head>
<title></title>
</head>
<body>
<form action="MyHandler.ashx" method="post">
姓名<input type="text" name="username"/>
<input type="submit" value="提交" />
</form>
</body>
</html>
ashx的代码:
<%@ WebHandler Language="C#" Class="MyHandler" %>
using System;
using System.Web;
public class MyHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
string path = context.Server.MapPath("HTMLPage.htm");
string content = System.IO.File.ReadAllText(path);
context.Response.Write(content);
string username=context.Request["username"];
context.Response.Write(username);
}
public bool IsReusable {
get {
return false;
}
}
}
---------------------- Windows Phone 7手机开发、.Net培训、期待与您交流! ----------------------