文件名不正确! [英] Incorrect File Name!

查看:88
本文介绍了文件名不正确!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我遇到了问题.我将gridview导出为ms-word.在Firefox中一切正常.但是在IE8中,单词文件的名称就是我的网页的名称.假设download.aspx.

我正在使用如下代码:

HttpContext.Current.Response.ContentType ="application/msword";

HttpContext

//此处是特定于应用的代码

StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
HttpContext.Current.Response.Write(strHTMLContent.ToString());
HttpContext.Current .Response.End();
HttpContext.Current.Response.Flush();

等待您的答复!

Pervaiz Iqbal Niazi.

解决方案

您好,

请您更详细地说明此问题吗?它说单词文档的全名是download.aspx.docx吗?您能告诉我们我们想要实现什么吗?如果要指定名称,则可以使用:

Response.AddHeader("content-disposition","attachment; filename = myfilename.doc"));

非常感谢您提供更多信息.顺便说一句,请在我们的 ASP.NET论坛中发布主题,您可能会在那获得更多帮助. blockquote>

Hello everybody!

I am running into a problem. I export my gridview into ms-word. Everything is working fine in firefox. But in IE8, the name of the word file is the name of my web page. Let say download.aspx.

I am using the code like:

HttpContext.Current.Response.ContentType = "application/msword";

HttpContext

//Application specific code here

 StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
HttpContext.Current.Response.Write(strHTMLContent.ToString());
HttpContext.Current.Response.End();
HttpContext.Current.Response.Flush();

Waiting for your reply!

Pervaiz Iqbal Niazi. 

解决方案

Hello,

Would you please be more specific about the issue?  Does it say the word document's full name is download.aspx.docx? Would you please tell us what do we want to achieve? If we want to specify a name, we could use:

Response.AddHeader("content-disposition", "attachment;filename=myfilename.doc");

Thanks a lot for providing more information. By the way, please post threads in our ASP.NET forum, you may get more help there.
Best regards,


这篇关于文件名不正确!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆