简单问题10分:如何将导向一个http的下载页面

abcd_net 2002-01-27 12:03:57
如何将导向一个http的下载页面,我用mappath只能导向服务器的盘符路径(例c:\)
...全文
190 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
julyclyde 2002-02-05
  • 打赏
  • 举报
回复
那需要你自己写服务器的代码啦。
hehongyu2000 2002-02-05
  • 打赏
  • 举报
回复
From MSDN:
When you call Server.Transfer, the state information for all the built-in objects will be included in the transfer. This means that any variables or objects that have been assigned a value in session or application scope will be maintained. In addition, all of the current contents for the request collections will be available to the .asp file receiving the transfer.

If the path you specify in the input parameter is for an .asp file in another application, the .asp file will execute as if it were in the application that contains the Server.Transfer command. In other words, all variables and objects that have been given application scope either by other .asp files in the application or by the application's Global.asa file will be available to the called .asp file. However, the path parameter must not contain an query string or ASP returns an error.

Server.Transfer acts as an efficient replacement for Response.Redirect. Response.Redirect tells the browser to request a different page. Since a redirect forces a new page request, the browser has to make two round trips to the Web server, and the Web server has to handle an extra request. IIS 5.0 introduced a new function, Server.Transfer, which transfers execution to a different ASP page on the server. This avoids the extra round trip, resulting in better overall system performance, as well as a better user experience.

linuxguoyy 2002-02-05
  • 打赏
  • 举报
回复
xingworld(星):怎么做到禁止站外链接下载。
abcd_net 2002-02-05
  • 打赏
  • 举报
回复
谢谢,能不能把第三条说得详细点
abcd_net 2002-02-05
  • 打赏
  • 举报
回复
upper
hehongyu2000 2002-02-04
  • 打赏
  • 举报
回复
1. If you just want to let browser download a file, you just need use response.redirect "xxxx.zip". Don't need use server.transfer "xxxx.zip"
2. If you really want to use server.transfer "xxxx.zip" in NT4, you just need to install II5 in NT4. Server.transfer method relies on IIS, not relies on OS.
3. The different on response.redirect "xxxx.zip" with server.transfer "xxxx.zip" is response.redirect let user's browser to send a request for "xxxx.zip" to server, response.transfer just keep the state information of all built-in object, server to execute the other page.
hehongyu2000 2002-02-04
  • 打赏
  • 举报
回复
If you used response.redirect "xxxx.zip", browser would prompt you to download a file. If you used server.transfer "xxxx.zip", browser would automaticly display content of the file. So, what is your point.
abcd_net 2002-02-04
  • 打赏
  • 举报
回复
upper
abcd_net 2002-02-04
  • 打赏
  • 举报
回复
server.transfer "xxxx.zip"用于2000,在NT4.0上无效
xhuayu 2002-02-03
  • 打赏
  • 举报
回复
是下载页面还是下载文件?
hehongyu2000 2002-02-03
  • 打赏
  • 举报
回复
Is this that you wanted?
response.redirect "download.htm"
abcd_net 2002-02-03
  • 打赏
  • 举报
回复
no .I want direct "XXXXX.zip"
abcd_net 2002-02-02
  • 打赏
  • 举报
回复
您说这些干什么,我晓得。我想要导向一个http的下载页面,可用什么函数或什么属性。(transfer用于2000,我的服务器是NT的)
abcd_net 2002-02-02
  • 打赏
  • 举报
回复
域名是要变的,要用于很多服务器。
ar7_top 2002-02-02
  • 打赏
  • 举报
回复
域名改变是很正常的,并且你不可以控制
但是目录的结构是你可以控制的呀
你可以使用相对路径就可以了
例如:

wwwroot 下面有1,2两个目录,1下面有11,12两个目录,2下面有21,22两个目录,每个目录下面有一个 index.htm 文件
他们之间的路径可以如下表示

11下的文件---12下的文件 ../12/12index.htm
12下的文件---11下的文件 ../11/11index.htm
21下的文件---22下的文件 ../22/22index.htm
22下的文件---21下的文件 ../21/21index.htm

11下的文件或者12下的文件--21下的文件 ../../2/21/21index.htm
11下的文件或者12下的文件--22下的文件 ../../2/22/22index.htm
21下的文件或者22下的文件--11下的文件 ../../1/11/11index.htm
21下的文件或者22下的文件--12下的文件 ../../1/12/12index.htm
xingworld 2002-02-02
  • 打赏
  • 举报
回复


不要那么绝对吗?用相对路径就可以啦,我以前写过一个禁止站外链接下载的程序……还行。
ehom 2002-02-02
  • 打赏
  • 举报
回复
你的域名总是固定的吧?用域名+到网站根目录的相对路径!
abcd_net 2002-02-01
  • 打赏
  • 举报
回复
upper.我该如何是好?
xyzoem 2002-01-27
  • 打赏
  • 举报
回复
用虚拟路径
http://
lihaitaoami 2002-01-27
  • 打赏
  • 举报
回复
mappath得到的是本机虚拟目录下文件的绝对路径。
/xxx/XXX.asp表示是根目录下的xxx目录下的文件。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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