Write information in the browser console via .Net

0

I need to show information in the console in the browser the classic console.log of JavaScript, but I would like to do this in the browser with .Net and not in the output of Visual Studio because I believe that Azure is preventing the execution of some methods of an application and as a quick solution I thought of inserting within the methods. I do not know if it is possible, or if it is the best option but it is a quick response.

MVC4 application, I use Firebug in browser .

    
asked by anonymous 05.01.2016 / 18:55

1 answer

1

This is not possible in this way. What runs in the browser is independent of what runs on the server. There is no way for the server (in the case of ASP.Net) to directly instruct what the browser should execute.

The maximum you can do is to generate a page in C # (via a view in MVC) that has JavaScript code to be run by the browser (preferably there is only the JS call on that page and the JS code itself is in a separate file already defined and saved in a static way). That is, what matters in order to do this is the part that will be inside <script></script> .

This page will obviously be sent to the HTTP server, which will then be sent to the browser. The browser that will run the JS code and do what you want.

    
05.01.2016 / 19:13