File Download Tips for asp.net
use http header
protected void Page_Load(object sender, EventArgs e)
{
string format = Convert.ToString(ViewData["format"]);
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("费用报销表", Encoding.UTF8) + string.Format(".{0}",format));
//测试中发现:如果要想在IE中直接打开PDF,上行代码,不能有!!否则即使客户端有设置,也会使用 Adobe Reader/Acrobat 打开
Response.ContentType = string.Format("application/{0}",format);
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.BinaryWrite(ViewData.Model);
Response.Flush();
//prevent render html to client(critical)
Response.End();
request to doc directly
Response.Redirect(“http://localhost:2222/Docs/abc.doc”, true);
Tips:
至于客户端使用浏览器打开(当然必须要相应的浏览器插件支持),还是相应的application (MS-Word,Adobe Reader),打开前是否提示下载,Server端是无法控制的,这个和用户设置有关系。见图
相关文档:
步骤:
1、先在D盘建一个新文件夹
2、打开VS2008,新建一个网站,更改名字后存放在1中的文件夹中,此时要记得给该网站建一个新的文件夹,专门用来存放该网站所有的文件;
3、搭建数据访问层,点击文件——添加——新建项目——类库,更改名字之后,存放在1中的文件夹中,同样也为数 ......
OnClientClick="this.disabled=true;this.form.submit();" UseSubmitBehavior="False"在按钮属性中加入这段代码
this.btnSubmit.Attributes["onclick"] = this.GetPostBackEventReference(this.btnSubmit) + ";this.disabled=true;";
如果是提交是一个Button,可以使用javascript,设置为en ......
示例
第一个示例演示如何创建 FileUpload 控件,该控件将文件保存到代码中指定的路径。
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  ......
本文和大家分享的是.NET中窗体的飘动。希望对大家有所帮助吧。
用.NET制作飘动的窗体时,需要使用Timer控件。首先,当窗体加载时设定一个初始位置,然后在窗体中定义两个Timer控件,其中timer1用来控制窗体从左向右飘动,timer2控制窗体从右向左飘动,当timer1启动后,每隔0.01s,都会在触发的事件中给 ......