| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 477 人关注过本帖
标题:请教一个 ASP读取地址
只看楼主 加入收藏
qjzjzx
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-5-27
收藏
 问题点数:0 回复次数:6 
请教一个 ASP读取地址

http://www.xxx.com/download.asp?id=555&xid=8&id=428

怎么使用ASP 来读取它 并且返回一个文件地址值,要用ASP自己在内部完成。

搜索更多相关主题的帖子: ASP 地址 
2007-05-28 00:51
caor1987
Rank: 1
等 级:新手上路
帖 子:228
专家分:0
注 册:2006-10-15
收藏
得分:0 

直接说调用下载函数咯。。
download.asp中的带奥妙应该是这样。。
<%
'Filename must be input
Function downloadFile(url)
' make sure you are on the latest MDAC version for this to work
' get full path of specified file
strFilename = server.MapPath(url)
' clear the buffer
Response.Buffer = True
Response.Clear
' create stream
Set s = Server.CreateObject("ADODB.Stream")
s.Open
' Set as binary
s.Type = 1
' load in the file
on error resume next
' check the file exists
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("<h1>Error:</h1>"&strFilename&" does not exists!<p>")
Response.End
end if
' get length of file
Set f = fso.GetFile(strFilename)
intFilelength = f.size
s.LoadFromFile(strFilename)
if err then
Response.Write("<h1>Error: </h1>Unknown Error!<p>")
Response.End
end if
' send the headers to the users Browse
Response.AddHeader "Content-Disposition","attachment; filename="&f.name
Response.AddHeader "Content-Length",intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
' output the file to the browser
Response.BinaryWrite s.Read
Response.Flush
' tidy up
s.Close
Set s = Nothing
End Function
%>
<%
'此处的 url 仅为下载文件的名称(包括扩展名)
loadfile = downloadFile(url) '调用文件下载函数
%>

2007-05-28 10:15
网航祖权
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2007-5-28
收藏
得分:0 
  上面的可以用了吗?

[clor=#ooffff] [B] 网航中国 www.  六线路服务器租用托管 QQ:6812244[/B][/color
2007-05-28 10:29
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

Function GetUrl()
On Error Resume Next
Dim strTemp
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & Request.ServerVariables("SERVER_NAME")
If Request.ServerVariables("SERVER_PORT") <> 80 Then
strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")
end if
strTemp = strTemp & Request.ServerVariables("URL")
If Trim(Request.QueryString) <> "" Then
strTemp = strTemp & "?" & Trim(Request.QueryString)
end if
GetUrl = strTemp
End Function

Response.Write(GetUrl())


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-05-28 12:02
qjzjzx
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-5-27
收藏
得分:0 

晕 我才来论坛 没想到大家回答这么积极,谢谢啊!

2007-05-30 12:40
lq7350684
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5089
专家分:98
注 册:2006-11-6
收藏
得分:0 
那以后要多来啊.
2007-05-30 14:07
qjzjzx
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-5-27
收藏
得分:0 

好的哦 前面的问题好像 没有达到我的目的! 可能是我说错了
http://bbs.bc-cn.net/viewthread.php?tid=143515&star=at#

2007-05-30 15:38
快速回复:请教一个 ASP读取地址
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018956 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved