我在IIS服务器上部署应用程序时代码不生成正确的Pdf文件 [英] Code Is Not Generating A Proper Pdf File While I Am Deploying Application On IIS Server
问题描述
这是代码,在本地主机上工作得非常好,但它不能在另一台机器上工作,我在iis服务器的帮助下访问同一个应用程序
和
this is the code,which works absolutely fine on local host but it's not working on another machine where i am accessing same application with the help of iis server
and
Report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,"IND " + lbl_QuotationId.Text.Trim()+"-FY15-16"+".pdf");
这个上面提到的代码我用来动态生成文件名但是这也可以在本地主机上精细地工作到另一台机器上;它没有生成文件名只取IND而不是其余的标签名称和-FY15-16字符串,并且还生成.dat格式的文件
可以任何人帮助我,请
this above mentioned code i am using to generate file name dynamically but this also working on local host finely and onto another machine it;s not generating file name its taking only "IND" not rest of the lable name and "-FY15-16" string and also generating file into .dat format
can any one help me out,please
int QuotationId = Convert.ToInt32(Session["QuotationId"]);
lbl_QuotationId.Text = QuotationId.ToString();
CrystalReportViewer1.Visible = true;
SqlConnection connection = new SqlConnection(CS);
SqlConnection connection1 = new SqlConnection(CS);
connection.Open();
SqlCommand command = new SqlCommand("Select QuotationId,Comp_CompanyName,Comp_CompanyCity,Comp_CompanyAddress,comp_Pin,comp_ContactNo,cust_CustomerName,Desccription,Price,Quantity,LineTotal,Country,DeliveryPeriod,Excise,Taxes,Freight,PayementTerms,RexrothPartNo From quotation where QuotationId=" + lbl_QuotationId.Text.Trim() + "", connection);
SqlDataAdapter adapter = new SqlDataAdapter(command);
FinalQuotation1 dataset = new FinalQuotation1();
adapter.Fill(dataset);
ReportDocument Report = new ReportDocument();
Report.Load(Server.MapPath("FinalQuotationReport.rpt"));
Report.SetDataSource(dataset.Tables[1]);
CrystalReportViewer1.ReportSource = Report;
Report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,"IND " + lbl_QuotationId.Text.Trim()+"-FY15-16"+".pdf");
请帮助,
先谢谢
please help,
Thanks in Advance
推荐答案
而不是连字符( - )使用下划线(_),你的问题应该解决。
使用某些特殊字符进行文件命名有时会在不同的浏览器上产生问题(通常)。我不确定根本原因。
类似的事情 -
Instead of hyphen (-) use underscore (_) and your problem should be resolved.
File naming with certain special characters sometimes creates problem on different browsers (generally). I am not sure about the root cause though.
Something like-
Report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,"IND " + lbl_QuotationId.Text.Trim()+"_FY15_16"+".pdf");
希望,它有助于:)
Hope, it helps :)
这篇关于我在IIS服务器上部署应用程序时代码不生成正确的Pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!