好记性不如烂笔头。

跨域上传文件

upload.ashx 接收端

```

<%@ WebHandler Language="C#" Class="upload" %>

using System;
using System.Web;

public class upload : IHttpHandler {

 public void ProcessRequest (HttpContext context) {
 var request = context.Request;
 var path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"upload/", "保存的文件名");
 request.Files[0].SaveAs(path);
 context.Response.Output.Write("OK");
 }

 public bool IsReusable {
 get {
 return false;
 }
 }

}

```

客户端:
```

var file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"fileName");
var data = new WebClient().UploadFile("接收端url", file);
var result = Encoding.UTF8.GetString(data); 

```