通过IE下载配置文件的问题,高分相酬,不够再加,先谢了

yaotang 2004-03-30 04:18:07
我通过IE下载并启动一应用程序(DownloadFile.exe),我还有另一更重要的目的是获得其配置文件(自动下载?!),通过其配置文件DownloadFile.exe.config读取指定的URL,从其下载相应的文件。根据msdn,依葫芦画瓢,写了一段在html中:
<LINK REL = "CONFIGURATION" HREF =
"Http://platform/ERPRun/DownloadFile.exe.config"/>
还有一份资料也说明了可行性,可是我的配置文件就是下载不下来
http://www.ondotnet.com/pub/a/dotnet/2003/01/27/ztd.html
...全文
50 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
yaotang 2004-04-05
  • 打赏
  • 举报
回复
yaotang 2004-04-01
  • 打赏
  • 举报
回复
其他高手也帮俺看看吧
andrawsky 2004-04-01
  • 打赏
  • 举报
回复
up
yaotang 2004-04-01
  • 打赏
  • 举报
回复
孟大侠,你好,不好意思,又打扰啦;我的问题依然没有解决,个人觉得原作者的这种方式应该是智能客户端的一种不错的方案,可是我试了又试(完全按照作者的步骤),还是没有实现,我也不知道原因,哎,才疏学浅那,你有空帮我看看吗?
yaotang 2004-04-01
  • 打赏
  • 举报
回复
今天好象没人呢
liuyu202 2004-03-31
  • 打赏
  • 举报
回复
关注!!!

顶!
yaotang 2004-03-31
  • 打赏
  • 举报
回复
哎,搞不定
孟子E章 2004-03-30
  • 打赏
  • 举报
回复
安照原文介绍,需要修改2个地方
1,在web.config里增加
<configuration>
<system.web>
<!--
Remove the *.config handler so that we_can serve up
*.exe.config files, but make it forbidden to serve up the
web.config file itself.
-->
<httpHandlers>
<remove verb="*" path="*.config" />
<add verb="*" path="web.config"
type="System.Web.HttpForbiddenHandler"/>
</httpHandlers>
</system.web>
</configuration>


2,修改iis,允许匿名访问
http://www.ondotnet.com/dotnet/2003/01/27/graphics/figure4.jpg
「已注销」 2004-03-30
  • 打赏
  • 举报
回复
没有试过,你自己试一试啦
yaotang 2004-03-30
  • 打赏
  • 举报
回复
非常感谢upto(阿球);能不能不通过ASP.NET去实现呢?
yaotang 2004-03-30
  • 打赏
  • 举报
回复
感谢二位;呵呵,又遇到可敬的孟子大侠:-)
孟子大侠,http://www.ondotnet.com/pub/a/dotnet/2003/01/27/ztd.html说明了可行性,可是
试过以后不行,不知何故
「已注销」 2004-03-30
  • 打赏
  • 举报
回复
//调用

<a href="Download.aspx?File=/MyPhile/Web.config"><img src="./Images/Download.gif" border="0" height="16" width="16" Alt="下载"></a>
「已注销」 2004-03-30
  • 打赏
  • 举报
回复
//download.aspx

<%@ Page language="c#" Codebehind="Download.aspx.cs" AutoEventWireup="false" Inherits="Wrox.WebModules.FileManager.Web.Download" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Download</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Download" method="post" runat="server">
<FONT face="宋体"></FONT>
</form>
</body>
</HTML>
「已注销」 2004-03-30
  • 打赏
  • 举报
回复
//download.aspx.cs

namespace Wrox.WebModules.FileManager.Web
{
/// <summary>
/// Summary description for Download.
/// </summary>
public class Download : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// 接收要下载的文件的路径,并创建一个 FileInfo 对象用于读取它的属性
string path = Server.MapPath(Request.Params["File"]);
System.IO.FileInfo file = new System.IO.FileInfo(path);

// 从缓冲区中清除当前输出内容
Response.Clear();
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
Response.AddHeader("Content-Length", file.Length.ToString());
// 指定返回的是一个不能被客户端读取的流,必须被下载
Response.ContentType = "application/octet-stream";
// 把文件流发送到客户端
Response.WriteFile(file.FullName);
// 停止页面的执行
Response.End();
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
孟子E章 2004-03-30
  • 打赏
  • 举报
回复
.config扩展名字的是不能下载的

62,254

社区成员

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

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

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

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