if i onclick of a button(btnConverttoPDF) in some form
itwill create pdf with all the content inside the form..
it's working fine locally..
But when the application is deployed in server then
it's raising an error.. as follows
"No connection could be made because the target machine actively refused it 127.0.0.15:55374"
WebException: unable to connect to the remove server
and mentioning the path of the file like
E:\Main\OnlineSite\OnlineBanking\ClosingBalance.aspx.cs
What i noticed here is 127.0.0.15 is my IP and 55374 is my portno where i developed the app
I found the issue..
<asp:Image ID="Image1" ImageUrl="http://localhost:55374/img/bank_logo.png" runat="server">
the above control is causing an issue.. during
htmlparser.Parse(sr);
May i know How can i resolve it?
What I have tried:
protected void btnconvert_Click(object sender, EventArgs e)
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
//To Export all pages
grdLast10trans.AllowPaging = false;
//Calling a Function, here im adding the data to the Datasource and diplaying in Grid
BindGrid();
content.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A3, 10f, 10f, 10f, 10f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
//pdfDoc.NewPage();
htmlparser.Parse(sr); //Error Occurring here
pdfDoc.Close();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(pdfDoc);
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
}
}