文件的下载,上传,和邮件的发送

1,文件的下载
        使用protected System.Web.UI.WebControls.HyperLink hlDownLoad控件,在它的NavigateUrl属性中设置为要下载文件的路径例如:../download/chm制作教程.rar  ,即可。
        这种方法,对压缩文件很有效,但是当要下载是*.txt,*.aspx等文件时,IE浏览器会自动把这些文件打开,考虑其他方法。
2
,邮件的发送

3,文件的上传
        使用protected System.Web.UI.HtmlControls.HtmlInputFile attach控件,代码如下:
        string fileName=Guid.NewGuid().ToString()+this.attach.PostedFile.FileName.Substring(this.attach.PostedFile.FileName.LastIndexOf("\\")+1);
   string strPath=Server.MapPath("./")+"load\\"+fileName;
   if(this.attach.PostedFile.ContentLength!=0)
   {
    this.attach.PostedFile.SaveAs(strPath);
    Response.Write("<script>confirm('上传成功');</script>");
    Response.Write("<script>window.location.href='test2.aspx'</script>");
   }
原文地址:https://www.cnblogs.com/sutengcn/p/199532.html