string strFilename_org=@"B:\1402\tmuninst1402.ini";System.IO.FileInfo file = new System.IO.FileInfo(strFilename_org);
Response.Clear();
string filename=@"e:\bak\"+strFilename_org;
filename=HttpUtility.UrlEncode(filename).Replace('+',' ');
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType ="text/html";
Response.WriteFile(file.FullName);
Response.End();
Page.RegisterStartupScript("alert","<script language='javascript'> alert('文件成功下载!!')</script>");
Response.Clear();
string filename=@"e:\bak\"+strFilename_org;
filename=HttpUtility.UrlEncode(filename).Replace('+',' ');
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType ="text/html";
Response.WriteFile(file.FullName);
Response.End();
Page.RegisterStartupScript("alert","<script language='javascript'> alert('文件成功下载!!')</script>");
解决方案 »
- 新手关于GridView的问题
- 居然没人知道?再发帖:登陆控件“注册”链接出错的问题
- 从数据库查询的数据绑定到Repeater,怎么把这些数据插入到数据库中的另一个表中???
- <ucOperation:OperationUC ID="OperationUC1" runat="server" />
- 如何捕获每次点击calendar事件
- 稀奇的BUG
- 关于DATASET绑定的问题!
- 请教,如何查寻的域用户基本信息? (如:姓名,显示名称,邮件地址等)
- 请各位高手看看给个方案,进者有分,不够再加
- 一个初级问题
- 我不会用VS.NET建立个网站???????
- 怎样得到DropDownList中选定的内容?
WebClient myClient = new WebClient();
Stream response = myClient.OpenRead("http://www.csdn.net/XXX.zip");
// 在这里把打开的流写到本地的文件中
response.Close();