原来asp都是传值过去嘛。看不到文件位置。然后直接就能下载的。拿.net 怎么做呢?
解决方案 »
- c#中winform下picturebox显示图像出现失真
- 数据库连接字符串
- 求教用C#调用做word转换html出现的问题
- SOCKET读写数据,如采用变长包,如何防止和剔除无效数据?★★算法为主★★
- DLL组件安装注册,急! 各位大侠救急
- C#中如何判断本机上是否装有SQL Server?急
- (C#)DataGrid.HitTestInfo这样的类,怎样设置????
- 水晶报表可以使用union吗
- Programming C# 和 Professional C# 这两本书哪本好些??
- 怎样将一个winform嵌到网页中!!!
- 请问如何将在 DataGrid 一栏里的ComboBox改为可以让使用者自行输入值进入
- 各位高手请教一个关于MDI的问题..
FileName = Server.UrlDecode(filePath)
If File.Exists(FileName) Then
Dim fi As New FileInfo(FileName)
Response.Clear()
Response.ClearHeaders()
Response.Buffer = False Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(destFileName), System.Text.Encoding.UTF8)) Response.AppendHeader("Content-Length", fi.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(destFileName)
Response.Flush()
Response.Clear()
Else
Response.Write("<script langauge=javascript>alert('文件不存在!');history.go(-1);</script>")
'Response.End()
End If
' File.Delete() Response.Write("<script language='javascript'>alert('" & Server.MapPath(".") + "\AttachFiles\tmp\" + NewDirName + Username & "!');</script>")
--我的一段程序,给你参照
http://www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx前两天刚从网上看到的~~~挺好用的~~试试吧!!!
FileName = Server.UrlDecode(filePath);
if (File.Exists(FileName)) {
FileInfo fi = new FileInfo(FileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(destFileName), System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length", fi.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(destFileName);
Response.Flush();
Response.Clear();
} else {
Response.Write("<script langauge=javascript>alert('文件不存在!');history.go(-1);</script>");
}
Response.Write("<script language='javascript'>alert('" + Server.MapPath(".") + "\\AttachFiles\\tmp\\" + NewDirName + Username + "!');</script>");没错吧?