Friday, 22 August 2014

run exe with parameter from asp.net c#

run exe with parameter from asp.net c#  :

run exe with parameter from asp.net c# 

aspx:cs

public void RunEXE()
        {
            System.Diagnostics.Process process1 = new System.Diagnostics.Process();

            process1.StartInfo.UseShellExecute = true;
//Exe Name
            process1.StartInfo.FileName = @"Sample.exe";
//Path Name
            process1.StartInfo.WorkingDirectory = @"E:\vijay\Sample\Bin\";
//Parameter Name
            process1.StartInfo.Arguments = @"E:\vijay\Sample\Bin\"+ "Test.txt";
            process1.Start();

            process1.WaitForExit();

            Thread.Sleep(20000);//Assume within 20 seconds it will finish processing. 
            process1.Close();
        }

run exe in asp.net c#

run exe in asp.net c# :

run exe in asp.net c#

aspx:cs

 public void RunEXE()

        {
            System.Diagnostics.Process process1 = new System.Diagnostics.Process();

            process1.StartInfo.UseShellExecute = true;
//Exe Name
            process1.StartInfo.FileName = @"Sample.exe";
//Path Name
            process1.StartInfo.WorkingDirectory = @"E:\vijay\Sample\Bin\";
            
            process1.Start();

            process1.WaitForExit();

            Thread.Sleep(20000);//Assume within 20 seconds it will finish processing. 
            process1.Close();
        }

folder all images get in asp.net

Folder all images get in asp.net  :

Folder all images get in asp.net  :

aspx:cs 

public void getAllImages()
        {
            string SourceLocation;
    //Image Folder
            SourceLocation="D:\Projects\Sample\source";
            DirectoryInfo dir = new DirectoryInfo(SourceLocation);
            FileInfo[] file = dir.GetFiles();

            StringBuilder sb = new StringBuilder();
            StringBuilder sbFrontImageName = new StringBuilder();
            StringBuilder sbbakImageName = new StringBuilder();
            bool frontImgName, bakImageName;
            foreach (FileInfo file2 in file)
            {
                if (file2.Extension == ".tif")
                {
                    string fname = file2.ToString();
  //Finding Image Name Front or Back Using Contains 
 //Sample_front_4.tif
 //Sample_back_4.tif
                    frontImgName = fname.Contains("front");
                    bakImageName = fname.Contains("back");

                    string imgName = file2.ToString();

                    if (frontImgName == true)
                    {
                        sbFrontImageName.AppendLine(SourceLocation + "\\" + fname);
                       

                    }
                    else
                    {

                        bakImageName = fname.Contains("back");
                        if (bakImageName == true)
                        {
                            sbbakImageName.AppendLine(SourceLocation + "\\" + fname);
                        }
                    }
                }
            }
            string ImgFrontTestINP, ImgBackTestINP;
            ImgFrontTestINP = SourceLocation + "\\" + "Test.inp";
            ImgBackTestINP = SourceLocation + "\\" + "Test_back.inp";

            System.IO.File.WriteAllText(ImgFrontTestINP, sbFrontImageName.ToString());
            System.IO.File.WriteAllText(ImgBackTestINP, sbbakImageName.ToString());
        }


Writting File :

Front Image Name written NotePad Test.inp:
----
Sample_front_1.tif
Sample_front_2.tif
Sample_front_3.tif
Sample_front_4.tif
Sample_front_5.tif

Back Image Name written NotePad Test_bak.inp:
----
Sample_back_1.tif
Sample_back_2.tif
Sample_back_3.tif
Sample_back_4.tif
Sample_back_5.tif