这是winform上的代码
private void button2_Click(object sender, EventArgs e)
{
System.Net.WebClient myWebClient = new System.Net.WebClient();
OpenFileDialog of = new OpenFileDialog();
if (of.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
FileInfo fileinfo = new FileInfo(of.FileName);
}
string fileName = of.FileName;
myWebClient.UploadFile("file:///E:\\TEST\\testclient\\HandleUpImage.ashx", "POST", fileName );
MessageBox.Show("ooooook");
}
//这是原本ashx上的代码
public class Uploader : IHttpHandler
7.{
8. public void ProcessRequest(HttpContext hc)
9. {
10. foreach (string fileKey in hc.Request.Files)
11. {
12. HttpPostedFile file = hc.Request.Files[fileKey];
13. file.SaveAs(Path.Combine(hc.Server.MapPath("."), file.FileName));
14. }
15. }
16.
17. public bool IsReusable
18. {
19. get { return true; }
20. }
21.}
点击了按钮 ,再用ie打开ashx显示上传图片是成功的,但是我再用VS2010打开ashx,里面就不是代码了,而是这样的
这是正常的吗 那我不能再用这个ashx的文件了?要用只能将这些全部删掉 重新写代码?