Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display C program errors in asp.net web page using c#

I am creating online compilers application. I have successfully created with C#.net and VB.net. But when I am trying with C and C++ I don't know how to display the errors in asp.net webpage.

The following only displays the error but not the location of the error in the code

Process proc = new Process();
proc.StartInfo.FileName = Session[batchPath].ToString();
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();

Is it right or I should do any modification? Thanks in advance.

like image 469
Balaji Kondalrayal Avatar asked Feb 25 '14 10:02

Balaji Kondalrayal


People also ask

How does ASP.NET handle errors?

You can handle default errors at the application level either by modifying your application's configuration or by adding an Application_Error handler in the Global. asax file of your application. You can handle default errors and HTTP errors by adding a customErrors section to the Web. config file.

How can error events be used to handle exceptions in C#?

Apart from the try catch exception handling technique, the ASP.NET Framework has error handling events where exceptions can be caught. When there is an unhandled error at the code level, meaning if the code does not have a structured try catch block to handle exceptions, then that can be handled at the page level.

How do I display error messages in ASPX?

Using JavaScriptAdd a new aspx page to the project, then add an ASP TextBox and Button to the aspx page. Then add a CustomValidator Control to the aspx page by going to the ToolBox then under that click Validation, select CustomValidator, then drag it to the page.

What is the error in the C program?

There are 5 different types of errors in C programming language: Syntax error, Run Time error, Logical error, Semantic error, and Linker error. Syntax errors, linker errors, and semantic errors can be identified by the compiler during compilation.


1 Answers

You get the results from your Process using the StandardOutput as

string cResults = proc.StandardOutput.ReadToEnd();
// and then wait to exit.
proc.WaitForExit();
like image 55
Aristos Avatar answered Oct 28 '22 11:10

Aristos