This application will read a file stored in server and
it will create a folder on client machine and store the file there for future reference.it will also print the contents on the printer attached on client machine. I M using dos command because other options requires manual file>print options to print the file and number of files is too large.
I Want the user to just click on the print button and all the files will be saved and printed.
First thing I would like to ask is , whatever code I will write for execution of dos command(for creation of folder on client machine and printing)will run on server or client machine.as far as I know c# code will execute on server side. What should I do to make it run on client machine.
I have a asp button on the page which when clicked should
create a folder on the clients hard disk eg: c: using dos command
Expand|Select|Wrap|Line Numbers
- MD somefoldername
Expand|Select|Wrap|Line Numbers
- PRINT filename
Expand|Select|Wrap|Line Numbers
- System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe");
- psi.UseShellExecute = false;
- psi.ErrorDialog = true;
- psi.RedirectStandardOutput = true;
- psi.RedirectStandardInput = true;
- psi.RedirectStandardError = true;
- psi.Arguments = "PRINT c:\\test.txt";
- //test.txt is already present on clients c:
- System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
- System.IO.StreamWriter sIn = proc.StandardInput; // Attach the in for writing
- System.IO.StreamReader sOut = proc.StandardOutput; // Attach the output for reading
- System.IO.StreamReader sErr = proc.StandardError; // Attach the output for errors
- proc.Close();
- string results = "";
- results = "<br /><b>Output : </b><br />" + sOut.ReadToEnd().Trim();
- results = "<br /><b>Error : </b><br />" + sErr.ReadLine().ToString();
- // Close the io Streams;
- sIn.Close();
- sOut.Close();
- sErr.Close();
- Response.Write(results);
I Also tried one other piece of code
Expand|Select|Wrap|Line Numbers
- Process proc = new Process();
- proc.StartInfo.UseShellExecute = true;
- proc.StartInfo.FileName = "calc";
- proc.StartInfo.Arguments = null;
- proc.Start();
- proc.WaitForExit();
I have searched the google and everywhere I get the same piece of code never mentioning it will execute on server or client. I tried to execute it on server to but with the same result. I will be grateful for the solution. It's very urgent.