Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.net server event handled client-side

I was wondering if anyone had an easy way to wire up javascript event handlers to events happening on the server-side. I have a long running process that includes a lot of steps, and would like the client to be continually updated with new information as the steps transition. Will this involve some sort of polling mechanism?

like image 323
Pierreten Avatar asked Jun 30 '10 17:06

Pierreten


People also ask

Is ASP client-side or server side?

There are several server-side technologies that can be used when developing web applications. The most popular is Microsoft's ASP.NET. In ASP.NET, server-side code uses the . NET Framework and is written in languages like C# and VB.NET.

What are client-side events?

A client is the browser or application that your user interacts with. A client-side event usually comes in the form of a tag and is sent directly from the client to Indicative or a tag manager (like Google Tag Manager). These tags are sent when an event like page view or button click is fired.

What is the event handler that occurs at the beginning of each request to the server?

Application_BeginRequest: This occurs at the beginning of each request to the server.

Can C# be used on client-side?

Blazor lets you use all your C# knowledge to apply in client-side development. Blazor replaces JavaScript code with C#. Essentially, it means that rather than writing the Client-side code in Angular, React, Vue using JavaScript and TypeScript, you can use C# and Razor.


1 Answers

Send an AJAX or JSON request from the client every so often asking for status.xml. Then, on the server, when something changes, just quickly write a new line to status.xml the same way you would to the console. You can use setInterval( function, timeBetweenRuns ) in Javascript to do this regularly.

like image 123
Just Jake Avatar answered Sep 28 '22 05:09

Just Jake