兼容ie,ff异步表单提交与无刷新提交
htm代码
秦仕川
handler.ashx文件
<%@ webhandler language="c#" class="handler" %>
using system;
using system.web;public class handler : ihttphandler {
public void processrequest (httpcontext context) {
var name = context.request["username"];
var age = context.request["age"];
var address = context.request["address"];
var file = context.request.files[0].filename;
var ret = name + " " + age + " " + address + " " + file;
writeform(context, ret);
}
public bool isreusable {
get {
return false;
}
}
public void writeform(httpcontext context,string str)
{
string method = context.request["callback"];
string hs = "";
context.response.write(hs);
context.response.flush();
context.response.close();
context.response.end();
}
}