How can I send a trigger to a client when a record request is posted on the database server?

How can I send a trigger to a client when a record request is posted on the database server?

I need to develop an application that can address the following: Customers will request recording of some programs on tape. So the request is saved on a database (actually, it is an Access database, but we are planning for SQL Server at a later stage). The employees are opening a dynamic Web page containing the recording information. I want this to happen: Whenever a record request is posted, a trigger is sent to the client and an update on the employee Web page is done without refresh. Can you please tell me what should be done on the employees' side and on the server side?

    Requires Free Membership to View

    When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchWinDevelopment.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchWinDevelopment.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

By the very nature of the Web and browsers, what you want to do isn't possible. There's no connection between the server and the client once a specific request has been satisfied. The server returns a response and forgets about the client. There's nothing you can do about that. This functionality is possible only for desktop apps. One workaround is to implement a background polling mechanism in the client-side by using JavaScript and the XmlHttpRequest object. With it, you can post a query to the server for information about changes. If you get new data in the response through the XmlHttpRequest, you can update the page view directly with DHTML from the JavaScript. This means the user will not see a page refresh.

On the server-side, you can either create an empty aspx form that processes these specific kind of posts, or you can create a custom IhttpHandler implementation, associate it with a new 'file' extension and process everything inside it. This is the most professional and reusable approach. However, implementing this feature increases network traffic, so you have to evaluate its benefits carefully.

This was first published in June 2003