Dear Experts,

I am trying to get out put, as this is working fine on my local machine running on server 2003, 32 bit, BUT when i upload it to VPS with same specifications , it gives following errors.

-System.ArgumentNullException: Value cannot be null. Parameter name: path at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) at System.Web.HttpServerUtility.Execute(String path, TextWriter writer) at ASP.soft_reports_prev1_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Inetpub\wwwroot\ictm\soft\Reports\prev1.aspx:line 94


I Really Need your Urgent Help

My Code is here :

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import namespace="APServerNET"%>
<%@ Import namespace="APWebGrbNET"%>
<%@ Import namespace="APToolkitNET"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>


<%
    OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.AppSettings["MM_CONNECTION_STRING_ictmdb"]);
    

    
try{
	string comp=Request.Form["comp"];
	string project=Request.Form["project"];
	string app_name=Request.Form["app_name"];
	string application=Request.Form["application"];
	string ctitle_align=Request.Form["ctitle_al"];
	string atitle_align=Request.Form["atitle_al"];
	string ptitle_align=Request.Form["ptitle_al"];		
	string atitle=Request.Form["atitle"];
	string ptitle=Request.Form["ptitle"];		
//	Response.Buffer=false;
	Server.ScriptTimeout=2400;
	string pdfurl="";
	int no=Convert.ToInt32(Request.Form["no"]),i=0;
	string ht=Request.Form["ht"];
	string ft=Request.Form["ft"];	

	ht="<br><br><table cellpadding=0 celspacing=0 width='100%'><tr><td width='33%' valign='top'>";
	bool f=false;
	if (ctitle_align=="1") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="1") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="1") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td><td width='33%' valign='top' align='Center' >";
	f=false;
	if (ctitle_align=="2") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="2") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="2") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td><td width='33%' align='right' valign='top' >";
	f=false;
	if (ctitle_align=="3") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="3") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="3") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td></tr></table><hr>";
   //Response.Write(ht);
  //  Response.Write(ctitle_align+"<br>");
 //  Response.Write(atitle_align+"<br>");
//   Response.Write(ptitle_align+"<br>");
//   Response.Write(atitle+"<br>");			
  //  Response.Write(ptitle);
    
    
    
	APWebGrabber wb=new APWebGrabber();
	APServer aps=new APServer();
	StringWriter wtr=new StringWriter();	
	i=Convert.ToInt32(Request.QueryString["n"]);
			string pg=Request.Form["fn_"+i];
			//if(Session.Contents["app_id"].ToString()=="63"){
           				Server.Execute(pg,wtr);
      			//}else{
			//Server.Execute(pg+"?pl="+(Request.Form["ori_"+i]=="1"?"1":"0"),wtr);
			//}
			string htm=wtr.ToString();

           //htm = htm.Replace("/ictm/", "http://127.0.0.1/ictm/");
           //htm = htm.Replace("/ictm/", "http://192.168.0.106/ictm/");
           //htm=htm.Replace("\"images/","\"http://192.168.0.106"+Request.Form["dir_"+i]+"/images/");
           //htm=htm.Replace("\"images\\","\"http://127.0.0.1"+Request.Form["dir_"+i]+"\\images\\");
           htm=htm.Replace("/ictm/soft/tmp/","http://124.217.245.184/ictm/soft/tmp/");
           htm=htm.Replace("/ictm/images/", "http://124.217.245.184/ictm/images/");
            //htm=htm.Replace("\\ictm\\images\\","http://127.0.0.1/ictm/images/");
            //htm=htm.Replace("=\"../","=\"http://127.0.0.1"+Request.Form["dir_"+i]+"/../");
            //string line="",cs="";
            //try 
            //{
            //    using (StreamReader sr = new StreamReader(Server.MapPath("/ictm/css/ee.css")) )
            //    {
            //        while ((line = sr.ReadLine()) != null) 
            //        {
            //            cs+="\n"+line;
            //        }
            //    }
            //}catch (Exception e){
            //    Console.WriteLine("The file could not be read:");
            //    Console.WriteLine(e.Message);
            //}
            //cs="<style>"+cs+"</style>";
            //htm=htm.Replace("<!-- Style -->",cs);
    
            // Changes by Naveed Qadri----july 7 2011
           pdfurl = "http://124.217.245.184" + Request.FilePath;
            //pdfurl = "http://192.168.0.106" + Request.FilePath;
			wb.URL=pdfurl;
			wb.PrintBackgroundColors=0;
			//wb.PrintBackgroundColors=2;
			wb.HTMLTextToFile=true;
			wb.CreateFromHTMLText=htm;
			
			if (Request.Form["back_"+i]=="Y")
				wb.EngineToUse=1;
			else
				wb.EngineToUse=0;
				
			aps.PaperSize=Convert.ToInt16(Request.Form["pg_"+i]);
			aps.Orientation=Convert.ToInt16(Request.Form["ori_"+i]);
			aps.Scaling=Convert.ToInt16(Request.Form["scaling_"+i]);
			wb.LeftRightMargin=(int)(Convert.ToDouble(Request.Form["lm_"+i])*600);
			wb.TopBottomMargin=(int)(Convert.ToDouble(Request.Form["tm_"+i])*600);
			wb.IELeftMargin=(float)Convert.ToDouble(Request.Form["lm_"+i]);
			wb.IERightMargin=(float)Convert.ToDouble(Request.Form["rm_"+i]);
			wb.IETopMargin=(float)Convert.ToDouble(Request.Form["tm_"+i]);
			wb.IEBottomMargin=(float)Convert.ToDouble(Request.Form["bm_"+i]);		
			wb.HeaderHTML=ht;
			wb.FooterHTML="<hr>";
			
			aps.OutputDirectory=Server.MapPath("/ictm/soft/tmp/reports");
			wb.Prt2DiskSettings=aps.XMLData();
            int ixi = wb.DoPrint("124.217.245.184", 64320);
            //int ixi = wb.DoPrint("192.168.0.106", 64320);
            if (ixi!=0) {
				Response.Write("There is a error "+ ixi);
				Response.End();
			}
            string wr = wb.Wait("124.217.245.184", 64320, 90, "");
			if (wr!="019"){
                if (wr == "099")
                { Response.Write("<font color='red'><em>Margin inconsistent with printable area. Please check your margins and page size.</em></font>"); }
                else
                { Response.Write("There is a PDF Job " + wr); }			
				Response.End();
			}
			aps.Wait(400);
			
			Response.Write(htm);
		
	aps.FromString(wb.Prt2DiskSettings);
    conn.Open();
    OleDbCommand  comm = new OleDbCommand("insert into ictm_print_TmpPdfs (proj_id,file_name) values ('" + Session.Contents["proj_id"].ToString() + "','" + aps.NewUniqueID + "')", conn);
    comm.ExecuteNonQuery();
    conn.Close();
    
	Response.Redirect("/ictm/soft/tmp/reports/"+aps.NewUniqueID + ".PDF");

}catch(Exception ex){
    
    //check error here naveed 
Response.Write("----"+ex.ToString());
}

%>

Recommended Answers

All 3 Replies

1) Did you forget to copy over some javascript to the server ("fn_" ...) ?
2) Are "pg" and/or "wtr" valid before the call to Server.Execute?

Thanks thines01 for helping me out.

Now I am gettting this error

System.Threading.ThreadAbortException:

, I have tried to delete all unnecessary codes from my code for your review.
what i check it stops on Server.Execute() ?

Margin inconsistent with printable area. Please check your margins and page size.----System.Threading.ThreadAbortException: Thread was being aborted. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object stateInfo) at System.Web.HttpResponse.End() at ASP.soft_reports_prev1_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Inetpub\wwwroot\ictm\soft\Reports\prev1.aspx:line 169

Kindly Review it nad help me,
Thanks alot

Dear Experts,


------------------------------------------------
I am trying to get out put, as this is working fine on my local machine running on server 2003, 32 bit, BUT when i upload it to VPS with same specifications , it gives following errors.
-----------------------------------------------------
I don't know where the problem is really.
I Really Need your Urgent Help
Here i am using Server.EXecute(), may be this is creating problem, I don't know.
I need your help plz.

My Code is here :

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import namespace="APServerNET"%>
<%@ Import namespace="APWebGrbNET"%>
<%@ Import namespace="APToolkitNET"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>


<%
    OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.AppSettings["MM_CONNECTION_STRING_ictmdb"]);
    

    
try{
	string comp=Request.Form["comp"];
	string project=Request.Form["project"];
	string app_name=Request.Form["app_name"];
	string application=Request.Form["application"];
	string ctitle_align=Request.Form["ctitle_al"];
	string atitle_align=Request.Form["atitle_al"];
	string ptitle_align=Request.Form["ptitle_al"];		
	string atitle=Request.Form["atitle"];
	string ptitle=Request.Form["ptitle"];		
//	Response.Buffer=false;
	Server.ScriptTimeout=2400;
	string pdfurl="";
	int no=Convert.ToInt32(Request.Form["no"]),i=0;
	string ht=Request.Form["ht"];
	string ft=Request.Form["ft"];	

	ht="<br><br><table cellpadding=0 celspacing=0 width='100%'><tr><td width='33%' valign='top'>";
	bool f=false;
	if (ctitle_align=="1") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="1") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="1") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td><td width='33%' valign='top' align='Center' >";
	f=false;
	if (ctitle_align=="2") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="2") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="2") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td><td width='33%' align='right' valign='top' >";
	f=false;
	if (ctitle_align=="3") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="3") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="3") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td></tr></table><hr>";
       
    
	APWebGrabber wb=new APWebGrabber();
	APServer aps=new APServer();
	StringWriter wtr=new StringWriter();	
	i=Convert.ToInt32(Request.QueryString["n"]);
			string pg=Request.Form["fn_"+i];
			Server.Execute(pg,wtr);
      									string htm=wtr.ToString();

                      htm=htm.Replace("/ictm/soft/tmp/","http://124.217.245.184/ictm/soft/tmp/");
           htm=htm.Replace("/ictm/images/", "http://124.217.245.184/ictm/images/");
                                 
                 pdfurl = "http://124.217.245.184" + Request.FilePath;
          			wb.URL=pdfurl;
			wb.PrintBackgroundColors=0;
			//wb.PrintBackgroundColors=2;
			wb.HTMLTextToFile=true;
			wb.CreateFromHTMLText=htm;
			
			if (Request.Form["back_"+i]=="Y")
				wb.EngineToUse=1;
			else
				wb.EngineToUse=0;
				
			aps.PaperSize=Convert.ToInt16(Request.Form["pg_"+i]);
			aps.Orientation=Convert.ToInt16(Request.Form["ori_"+i]);
			aps.Scaling=Convert.ToInt16(Request.Form["scaling_"+i]);
			wb.LeftRightMargin=(int)(Convert.ToDouble(Request.Form["lm_"+i])*600);
			wb.TopBottomMargin=(int)(Convert.ToDouble(Request.Form["tm_"+i])*600);
			wb.IELeftMargin=(float)Convert.ToDouble(Request.Form["lm_"+i]);
			wb.IERightMargin=(float)Convert.ToDouble(Request.Form["rm_"+i]);
			wb.IETopMargin=(float)Convert.ToDouble(Request.Form["tm_"+i]);
			wb.IEBottomMargin=(float)Convert.ToDouble(Request.Form["bm_"+i]);		
			wb.HeaderHTML=ht;
			wb.FooterHTML="<hr>";
			
			aps.OutputDirectory=Server.MapPath("/ictm/soft/tmp/reports");
			wb.Prt2DiskSettings=aps.XMLData();
            int ixi = wb.DoPrint("124.217.245.184", 64320);
            //int ixi = wb.DoPrint("192.168.0.106", 64320);
            if (ixi!=0) {
				Response.Write("There is a error "+ ixi);
				Response.End();
			}
            string wr = wb.Wait("124.217.245.184", 64320, 90, "");
			if (wr!="019"){
                if (wr == "099")
                { Response.Write("<font color='red'><em>Margin inconsistent with printable area. Please check your margins and page size.</em></font>"); }
                else
                { Response.Write("There is a PDF Job " + wr); }			
				Response.End();
			}
			aps.Wait(400);
			
			Response.Write(htm);
		
	aps.FromString(wb.Prt2DiskSettings);
    conn.Open();
    OleDbCommand  comm = new OleDbCommand("insert into ictm_print_TmpPdfs (proj_id,file_name) values ('" + Session.Contents["proj_id"].ToString() + "','" + aps.NewUniqueID + "')", conn);
    comm.ExecuteNonQuery();
    conn.Close();
    
	Response.Redirect("/ictm/soft/tmp/reports/"+aps.NewUniqueID + ".PDF");

}catch(Exception ex){
    
    //check error here naveed 
Response.Write("----"+ex.ToString());
}

%>

Are you attempting to print something?
If so, have you set the margins or checked them to see if they are set to something invalid??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.