1.
public
static
void
Priview(System.Web.UI.Page p, string inFilePath)
2.
{
3.
p.Response.ContentType =
'Application/pdf'
;
4.
string fileName = inFilePath.Substring(inFilePath.LastIndexOf(
''
) +
1
);
5.
p.Response.AddHeader(
'content-disposition'
,
'filename='
+ fileName);
6.
p.Response.WriteFile(inFilePath);
7.
p.Response.End();
8.
}
01.
public
static
void
Preview(System.Web.UI.Page p, string inFilePath)
02.
{
03.
string fileName = inFilePath.Substring(inFilePath.LastIndexOf(
''
) +
1
);
04.
p.Response.ContentType =
'text/plain'
;
05.
p.Response.ContentEncoding = System.Text.Encoding.UTF8;
//保持和文件的編碼格式一致
06.
p.Response.AddHeader(
'content-disposition'
,
'filename='
+ fileName);
07.
p.Response.WriteFile(inFilePath);
08.
p.Response.End();
09.
}
聯(lián)系客服