r****y 发帖数: 26819 | 1 Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
strFileName);
Response.ContentType = "application/octet-stream";
Response.WriteFile(strFileName);
Response.End();
执行没有问题。唯一的问题是,IE总要自动rename这个save as...dialog,给文件名第一
个.之前自动加上[1]。比如文件原名download.mp3,就会变成download[1].mp3.
Firefox就不会这么干。
这可能和.NET无关。怎么避免IE自动rename?应该是可以避免的。因为很多下载都不会
自动加[1]。可能因为这个例子是作为attachment的问题。 |
|
l*s 发帖数: 783 | 2 ☆─────────────────────────────────────☆
rodney (gotoAndPlay(0)) 于 (Mon Feb 12 15:01:35 2007) 提到:
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
strFileName);
Response.ContentType = "application/octet-stream";
Response.WriteFile(strFileName);
Response.End();
执行没有问题。唯一的问题是,IE总要自动rename这个save as...dialog,给文件名第一
个.之前自动加上[1]。比如文件原名download.mp3,就会变成download[1].mp3.
Firefox就不会这么干。
这可能和.NET无关。怎么避免IE自动rename?应该是 |
|
m****r 发帖数: 141 | 3 I am compiling a LaTeX file with 10 chapters and a table of contents. I have
added the following in the first page.
But why is the table of contents still missing?
thanks !!!
Any help will be appreciated.
This is the main file.
\pdfbookmark[1]{TABLE OF CONTENTS}{table}
\tableofcontents
\addtocontents{toc}{\def\protect\@chapapp{}} \cleardoublepage \
phantomsection
\addcontentsline{toc}{chapter}{LIST OF TABLES}
\listoftables
\cleardoublepage \phantomsection \addcontentsline{toc}{chapter}{LIST OF
F... 阅读全帖 |
|
m****r 发帖数: 141 | 4 I am compiling a LaTeX file with 10 chapters and a table of contents. I have
added the following in the first page.
But why is the table of contents still missing?
thanks !!!
Any help will be appreciated.
This is the main file.
\pdfbookmark[1]{TABLE OF CONTENTS}{table}
\tableofcontents
\addtocontents{toc}{\def\protect\@chapapp{}} \cleardoublepage \
phantomsection
\addcontentsline{toc}{chapter}{LIST OF TABLES}
\listoftables
\cleardoublepage \phantomsection \addcontentsline{toc}{chapter}{LIST OF
F... 阅读全帖 |
|
h**6 发帖数: 4160 | 5 已知n个文件,和异步写单个文件的函数,void writeFile(int fileIndex, callback
cb); 其中callback是std::function
现在需要以递不减的顺序写文件,即可能是1、2、3、3、5、5、7、12这样可重复可跳
过无返回的顺序。
要求写出另一个异步写单个文件的函数,调用writeFile,但确保不会同时写同一文件
。 |
|
q*q 发帖数: 145 | 6 of course not,
InfoEdit-->WriteFiles-->1 |
|
t********k 发帖数: 808 | 7 I want to read or write a binary file in pb5.
But the functions,such as FileRead,FileWrite are
work in ASCII.So i want to use API functions.
OpenFile or CreateFile
ReadFile or ReadFileEx
WriteFile or WriteFileEx
CloseHandle
Can you tell how to declare these extern functions
in pb?
BTW,do we can use following functions in pb?
How to declare them?
_lopen,_lread,_lwrite,_lclose
Thanks. |
|
t********k 发帖数: 808 | 8 I want to read or write a binary file in pb5.
But the functions,such as FileRead,FileWrite are
work in ASCII.So i want to use API functions.
OpenFile or CreateFile
ReadFile or ReadFileEx
WriteFile or WriteFileEx
CloseHandle
Can you tell how to declare these extern functions
in pb? |
|
S***k 发帖数: 370 | 9 I guess you have VB code to create the excel file, and the created excel
file includes not only the results but the VB code itself also.
If this is the case, you may try
This.Visible = false;
Response.clear();
Response.ClearContent();
Response.ClearHeaders();
Response.WriteFile(…);
Response.End(); |
|
l*s 发帖数: 783 | 10 There is a bug in IE that the [n] decorations will be inserted to the
filename if it contains two periods. I don't konw if this is what you
encountered.
Or try delete the IE cache.
第一 |
|
c**t 发帖数: 2744 | 11 if you can, detect if file exists first. I don't think that's a bug, it IS a
feature.. |
|
r****y 发帖数: 26819 | 12 It has nothing to do with cache. Say, if you view source of a page, it will
add [1] automatically to the file name showing in notepad.
New question is: if I want to let asp.net download a mp3, instead of showing
save as... prompt, it will automatically be played by windows media player.
How to do this? |
|
a9 发帖数: 21638 | 13 那跟asp.net无关,跟ie和explorer的设置有关,你改不了的。
或者你用mms协议传
will
showing
. |
|
r****y 发帖数: 26819 | 14 不全是这么回事。
这么说吧,
1:假如我在IE地址栏直接给出一个mp3的http的URL,我的机器表现是,启动
Flashget提示下载,选择cancel以后,windows media player开始播放。
2:但是如果用我前面列出的asp.net代码,就是提示保存attachment, save as。
3:然后另外还有一个http的URL,PHP代码的,在IE地址栏给出以后,直接启动
windows media player开始播放。
我的机器设置没有变,但是这就有三种不同。而这第三种是我想用asp.net做到的。 |
|
a9 发帖数: 21638 | 15 那是因为flashget关联了mp3,把它给截获了。 |
|
r****y 发帖数: 26819 | 16 flashget关联的是所有IE里的URL。
问题是,别人的URL,就没有这个问题,不被Flashget截获,直接播放。
只不过是php代码的,我无法知道怎么写的。 |
|
|
a9 发帖数: 21638 | 18 实在不行你就用tcp连接直接请求一下,看看headers里面到底有些啥。 |
|
r****y 发帖数: 26819 | 19 这个我也做了。就用在线的工具:
http://web-sniffer.net/
结果:
HTTP Status Code: HTTP/1.1 200 OK
Date: Mon, 12 Feb 2007 22:58:28 GMT CRLF
Server: Apache/1.3.34 (Unix) mod_ssl/2.8.25 OpenSSL/0.9.7i CRLF
Pragma: CRLF
Cache-Control: max-age=3600, public CRLF
Set-Cookie: CRLF
Expires: Mon, 12 Feb 2007 23:58:28 GMT CRLF
Last-Modified: Mon, 12 Feb 2007 22:58:28 GMT CRLF
ETag: "e00bc8bed4cc7213dc38781fdfe9ce86" CRLF
Content-Length: 1921357 CRLF
Connection: close CRLF
Content-Type: audio/mp3
Content:就是mp3文件 |
|
r****y 发帖数: 26819 | 20 用这个做的也一样:
http://www.rexswain.com/httpview.html
Receiving Header:
HTTP/1.1·200·OK(CR)(LF)
Date:·Mon,·12·Feb·2007·23:01:07·GMT(CR)(LF)
Server:·Apache/1.3.34·(Unix)·mod_ssl/2.8.25·OpenSSL/0.9.7i(CR)(LF)
Pragma:·(CR)(LF)
Cache-Control:·max-age=3600,·public(CR)(LF)
Set-Cookie:·(CR)(LF)
Expires:·Tue,·13·Feb·2007·00:01:07·GMT(CR)(LF)
Last-Modified:·Mon,·12·Feb·2007·23:01:07·GMT(CR)(LF)
ETag:·"e00bc8bed4cc7213dc38781fdfe9ce86"(CR)(LF)
Content-Length:·1921357(CR)(LF)
Connection:·close(CR)(LF)
Content-Ty |
|
|
r****y 发帖数: 26819 | 22 我怀疑人家php代码相当于不是用attachment,而是直接向Response写这个mp3。 |
|
a9 发帖数: 21638 | 23 那你把.net的content-type也改成audio/mp3试试啊。 |
|
|
r****y 发帖数: 26819 | 25 试过了,因为是attachment,所以没有变化。 |
|
|
a9 发帖数: 21638 | 27 去掉Response.AddHeader("Content-Disposition", "attachment; filename=" +
strFileName);这行呢? |
|
|
r****y 发帖数: 26819 | 29 对方就是一个上传mp3的php网页。我只是想用asp.net完全仿制。 |
|
|
|
|
s***o 发帖数: 2191 | 33 not sure why you want .html files, which contain static content, to go
through view engine. If you just want to keep cleaner URL, using something
like Response.WriteFile, Server.Transfer, etc in an action method may be an
easier hack. |
|
z***e 发帖数: 5393 | 34 【 以下文字转载自 Seattle 讨论区 】
发信人: zlike (最终幻想), 信区: Seattle
标 题: 顺便问一个CreateFile问题
发信站: BBS 未名空间站 (Sat Jun 7 04:04:00 2008)
Visual Studio里面缺省是Unicode.
随便const TCHAR *s=_TEXT("asdfsdfsdfsddfsdfsddfdsfsdf");
然后CreateFile(),WriteFile(....)....
那个出来的text文件始终是Unicode的,如果改project configuration,改成unset的话
就是ANSI,问题是我要UTF-8的,怎么生成啊?
之所以要UTF-8,是因为生成的是一个xml,然后另外一个C#的程序去读,如果unicode
的话那个C#里面的那个XMLxxxx就要发神经报错,ANSI就没问题。 |
|
c****r 发帖数: 15 | 35 如果是on Windows的话,use asynchronous file writing. 参考WriteFile Win32 API
. |
|
X****r 发帖数: 3557 | 36 CreateFile
SetFilePointerEx
WriteFile
CloseHandle |
|
c*****t 发帖数: 1879 | 37 /* a code I wrote long time ago for this purpose */
#include
#include
#include
#include
#include
#include
#ifndef true
#define true 1
#define false 0
#endif
int Error (char *);
long filelength (FILE *f)
{
register long size, pos = ftell (f);
fseek (f, 0, SEEK_END);
size = ftell (f);
fseek (f, pos, SEEK_SET);
return size;
}
int writefile (FILE *infile, char *filename, long filesize)
{
FILE *outfile;
char buffer[409 |
|