如此一般的下载文件吧
string filepath="";
filepath=Server.MapPath("ImgeTemp")+"//temp.jpg";
System.IO.FileInfo myFile = new System.IO.FileInfo(filepath);
filename=this.Request["ImgePath"];
filename=filename.Substring(filename.Length-3,3);
if (filename=="jpg")
{
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(myFile.Name));
}
else
{
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("temp.tif"));
}
Response.AddHeader("Content-Length", myFile.Length.ToString());
this.Response.ContentType="application/octet-stream";
Response.WriteFile(myFile.FullName);
Response.flush();
this.Response.End();
//如此发邮件
这个是最好我成功运行的结果,大家看看,谢谢大家了:
//创建MailMessage对象
MailMessage mailMsg = new MailMessage();
//设置收件人的邮件地址
mailMsg.To = "evien007@yahoo.com.cn";
//设置发送者的邮件地址
mailMsg.From = "kevinxwww@163.com";
//设置邮件主题
mailMsg.Subject = "测试";
//设置邮件内容
mailMsg.Body = "你的用户名是866666密码是533332";
//设置为需要用户验证
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//设置验证用户名(邮箱的用户名)
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "kevinxwww");
//设置验证密码(邮箱的密码)
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password");
//设置发送邮件服务器
SmtpMail.SmtpServer = "smtp.163.com";
//发送邮件
SmtpMail.Send(mailMsg);
msg.Text = "邮件发送成功";