We have a window application and a web application, and both connect to a same database to handle data. User on web application will do some changes and wait for the approve from users on window application. Is there any way to show a live update or notification on web application whenever an approve is made at window application which is lead to change in database?
Note: we use ASP.NET for web application and .NET for windows application
This link which talks about SQLDependency and Query Notification seems to be what you are looking for.
You could setup a "notification" area within an updatepanel, or just use straight up ajax to make queries to the database on a specified interval as well.
There are several options.
you can refresh your ASP.NET page by regular interval. http://www.devcurry.com/2009/03/how-to-refresh-aspnet-gridview.html
Refresh a portion of the page periodically using AJAX. I would use jquery for the ajax stuff: jquery.com
Not sure how long the approval process is expected to take, but you could set the page to poll the server every 5 seconds, 15 seconds, whatever makes sense. If it's just refreshing a small portion of the page, it shouldn't be too much of a burden on the server relative to reloading the entire page at every interval.
Related
I'm fairly new to MVC and web programming at all. I need to solve one problem.
Let's say I have complete and working mvc app, web services (it might be anything - wcf, servicestack, web api...) and mobile apps (iOS, Android) working with my web service. Now when I'm on my Admin page is there a way for me update this admin page without having to reload it in response to web service requests when my mobile clients send one.
I don't want to ask my database for changes every few seconds though. I really want this flow:
I'm looking at my admin page -> Mobile app is sending a request (for example if user clicked a button or changed position) -> Web service gets the request -> ???? -> Data on my admin page changes.
Edit: Ok. Why it's always like this ? You look for an answer for long time. Then you ask a question and few minutes later you find possible solution. What I've already found is server side js events, websockets and long polling. Am I heading in the right direction?
For ServiceStack you can get real-time updates with Server Events. You can use the C#/.NET ServerEvents Client with Xamarin.iOS and Xamarin.Android to handle Server Push events on iOS and Android.
I think what you might be looking for is http://signalr.net/
I'm currently working on an asp.net website.
I have a page (main.aspx) which displays records from a database table. Another page (editing.aspx) is responsible for editing records in the DB table.
let's assume we have a scenario where two users are using the website, user1 (on session1) is viewing the records in main.aspx, user2 (on session2) is editing the DB table from editing.aspx, what I want is: to refresh main.aspx for user1 when user2 saves his changes to the DB table.
I tried using an AJAX timer that pulls the DB for changes every 10 seconds, and refreshes an UpdatePanel (in which I'm displaying the records), and it works just fine, but I want to know if there'se a better way than pulling the DB server for changes.
thanks.
It is debatable if the other way is better but what you are looking for is persistent connection to the server that lets the server send e message to the page. There is a good library for .NET called SignalR that abstracts away the details. It is certainly more network efficient but depending on your use case the update panel may be good enough. Basically with SignalR you will send a message from the server-side code of your edit page which would be received by a JavaScript function on your main page. Then you either show the data or cause a refresh in some way.
I m developing web application using ASP.NET and I want to close the current user session if the computer is idle for 5 minutes. Idle not means for web application only, Its full system that means if no keystroke received from keyboard for 5 mins.
I got some info thru Google about Idle Tracker in VC++ but I dont know how to use that DLL in my web application. Link here.
Please guide me how to achieve this. I want to get the total computer active time and idle time thru asp.net for my employees productivity report.
ASP.Net is a bad choice for this requirement. ASP.Net runs on the server, while you want to track some client side events.
For security reasons, a web page can't have such privileges without the use of ActiveX or browser plugin, but it's complex to write, complex to deploy and a big opened window to security breaches.
You should create a classic desktop application, or search for an option in the GPOs, there's maybe something.
The simple solution I can suggest is :
Create a small script file that logoff the user (search for the logoff command line)
Create a scheduled task that :
triggers when a specified amount of idle time has been reached
launch the script file you wrote
Deploy the scheduled task to the users using whatever method you want
If you choose this approach, I recommand you to move to http://superuser.com or http://serverfault.com, which are correct place for such cases
I want a page to run in the background in my Asp .Net web application.
That page should not be visible to the user.
The exact use of this page: the user will schedule a mail, that is to be send later. After he scheduled, the page should be hidden.
Can we do it?
Platform version (.NET 4)
What you really want is a service.
However, there are several kludgy ways to do back ground tasks with asp.net
http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc
http://www.west-wind.com/weblog/posts/2007/May/10/Forcing-an-ASPNET-Application-to-stay-alive
http://www.mikesdotnetting.com/Article/129/Simple-task-Scheduling-using-Global.asax
If the user closes the browser before your scheduled event has occurred, it will never take place.
You really want a backend service that processed queued events. When the user schedules an email it adds it to the queue and then gets picked up and processed by the backend service.
http://quartznet.sourceforge.net/ is one option for it, or you could build a window's service and the queue manually.
Alternatively you could look into a service bus approach such as http://www.nservicebus.com/ which is backed by MSMQ.
Suppose I have either an ASP.NET displaying my results, or a Silverlight client. And I'd like to show the current status of my server, or embedded device. (pretend the device reads temperature and humidity stats)
How should I send the status information from my device to the front end? Should I poll the device and save the results to SQL, Azure Table, or the like? (Azure is a technology that fits with this project for other reasons. That's why I mention it)
Or should I create a WCF service that polls the device directly and returns the current status.
What makes more sense?
In either ASP.NET or Silverlight you are going to have to poll from the client (web page or Silverlight app) to the backend to get the current status. In ASP.NET I'd look into doing this via an AJAX poll to a service using Javascipt (look at using Jquery or something similar to make this easier).
In silverlight you will need to have some sort of service configured to return the results and poll it using the Timer control running on a seperate thread.
You can also using a "push" binding within your silverlight app. Basically instead of you manually polling the server, the server will send you a push notification anytime it deems it necessary to let the client know of any change.