sina的下载!!

qqrong1 2003-10-09 03:47:03
麻烦请问
如何实现,对下载带出的新网页的关闭呢?
就像sina的下载,只留下载的对话框,而关闭带出的网页!
...全文
169 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
qqrong1 2003-10-10
  • 打赏
  • 举报
回复
都实现不了啊!
asam2183 2003-10-09
  • 打赏
  • 举报
回复
搞错了:
string filePath="路径"+"/"+sFileName;
string sFileName="text1.txt";
asam2183 2003-10-09
  • 打赏
  • 举报
回复
string sFileName="C:\temp.txt";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(sFileName,System.Text.Encoding.UTF8));
Response.WriteFile(filePath);
Response.End();
NetFire 2003-10-09
  • 打赏
  • 举报
回复

'//how to
Dim temp As Integer = InStr(url, "http://www.sina.com/soft")
If temp <> 0 Then
Dim path As String = Server.MapPath(Mid(url, temp + 33))

Dim result As String = Replace(path, "F:\aaa", "K:\bbb")

Dim file As FileInfo = New FileInfo(result)
Response.Clear()


Response.AddHeader("content-disposition", "attachment; filename=" + file.Name)

' add the header that specifies the file size, so that the browser
' can show the download progress
Response.AddHeader("content-length", file.Length.ToString())

' specify that the response is a stream that cannot be read by the
' client and must be downloade
Response.ContentType = "application/octet-stream"

' send the file stream to the client
Response.WriteFile(file.FullName)

' stop the execution of this page
Response.End()

'Label1.Text = result
End If
qqrong1 2003-10-09
  • 打赏
  • 举报
回复
有人吗

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧