>>>1)response。BinaryWrite出文件以后,客户端看到的文件名是 ,showfile。aspx,如何才能在服务端指定一个文件名?比如a.bmp,b.doc,c.xml什么的。try something likeResponse.Clear();
Response.ContentType = "image/jpeg";
Response.AddHeader("Content-Disposition", "attachment;filename=myimage.jpg");
Response.AddHeader "Content-Length", "123131");//size of the file
Response.BinaryWrite(...);
Response.End();
>>>2)如果是个txt文件,除了文件的内容以外,还写入了aspx文件本身的html代码。我的response.clear()然后response.binaryWrite(byte[])的数据,然后立刻response。end了,还是不行。我不知道是不是要overridde父类的某个方法才行。msdn查了半天,没有。或者说我想完全控制相应给用户的所有信息,了解aspx页面生成的顺序和机制,有没有那位大侠提供这方面的资料?拉兄弟一把?try something likeResponse.Clear();
Response.ContentType = "application/octet-stream"; //this also works for other file types
Response.AddHeader("Content-Disposition", "attachment;filename=myfile.txt");
Response.AddHeader "Content-Length", "123131"); //size of the file
Response.BinaryWrite(...);
Response.End();
Response.ContentType = "image/jpeg";
Response.AddHeader("Content-Disposition", "attachment;filename=myimage.jpg");
Response.AddHeader "Content-Length", "123131");//size of the file
Response.BinaryWrite(...);
Response.End();
>>>2)如果是个txt文件,除了文件的内容以外,还写入了aspx文件本身的html代码。我的response.clear()然后response.binaryWrite(byte[])的数据,然后立刻response。end了,还是不行。我不知道是不是要overridde父类的某个方法才行。msdn查了半天,没有。或者说我想完全控制相应给用户的所有信息,了解aspx页面生成的顺序和机制,有没有那位大侠提供这方面的资料?拉兄弟一把?try something likeResponse.Clear();
Response.ContentType = "application/octet-stream"; //this also works for other file types
Response.AddHeader("Content-Disposition", "attachment;filename=myfile.txt");
Response.AddHeader "Content-Length", "123131"); //size of the file
Response.BinaryWrite(...);
Response.End();
解决方案 »
- Treeview的一些老问题 大伙都进来看看
- 急!!!Asp.Net 调试问题
- 请问Hashtable怎么转换为Json
- 这么菜还出来吓人真的是我的不对
- HyperLink控件显示时的问提
- 在DataGrid中模板列绑定了两个DropDownList怎样实现联动?急
- 昏,asp.net中的DataGrid控件真是垃圾,怎么使用列名来访问某单元的内容啊!
- 分页时用存储过程方法的思想是什么?即那几句存储过程代码的意思是什么 ?
- Jquery的 ajax方法 一直提交不到后台去 救急。高了一天了。
- .net IIS7 下测试 发现应用程序池 内存一直上涨 还请各位大侠分析分析
- 关于防止盗链图片的问题
- crystal report中显示sql server数据库中的图片
//有一本新书《深入asp.net组件设计》博文出的,第三章内容比较详细,你可以去书店看那章:)//上面生成图片的问题以前我作过把一个网页转换成ContentType = "image/jpeg"
图片的控件连接地址就是这网页,加个参数比如xxx.aspx?id=
xxx代表你你转换的网页,也就是你的图片控件连接地址,该网页获取参数后执行数据的处理
就可以了