I have a web application which our customer use it all day. Some times, i need to stop or restart application. When I do it, some customers' work is interrupted and this makes them nervous.
I want to make a notification system that, appear on application and inform customers about shutting down of system.
How can I make a system like that?
For notification you can use stackoverflow-style-notifications
You also can customize error page "HTTP Error 500-12 Application Restarting"
I think the way to go here is with AJAX. Make some kind of Polling system which would poll every 5 or so minutes for new 'messages' on the server. your C# would then check if there are new messages, return them to the AJAX and some jQuery could could display a box or a modal to alert the user something will happen soon.
On refreshing a page or going to a new page this ajax could then run too, not waiting for the timer to run out.
You can use a service on your network but there is another simple way...
there is a dos command which shows a message on specified user's screen... but this is worst way if ur program is not running on a small network...
The command is NET SEND but its no more available in windows vista and seven...
Here is the refrence: http://www.cezeo.com/tips-and-tricks/net-send-command/
You would put a message on a common page (home or login) a while before the update. Something like "At xxxxxpm this site will be down".
When the time comes you replace their access to the system (such as the login page) with a page stating its down, you'll have to wait. You would either place the new message page with that of the same name as the login, or configure the server to redirect automatically. This is how the major banks manage it.
Related
I want to write C# windows application and save it on server.
This application shows message to user when request come to server.
For more explain, I apex web application on my server and I want to show me message when network user request that application and more explain,my apex program URL is this:
http://serverIP:7777/rafm/f?p=105:LOGIN:2771142526496053
And, when my local network user request that URL, on server C# windows application show me for example "ok" message,How can i write this purpose?thanks.
Short answer is: you shouldn't.
Server applications should be designed to run "headless", meaning without a screen or console. What would happen if your server is running without a physical monitor? Or without any user logged in? Who would see this messagebox? Who would dismiss this messagebox? If 1,000 users log in, would there be 1,000 messageboxes? That would be unmanageable. This is why server frameworks like ASP.NET or Salesforce's APEX don't even allow you to do that - they literally don't have a Messagebox.Show command available, because they're not running in the context of a windowing system.
What you need to do is simply write this information to a log - either a log file, Windows Event Log or any other logging facility, and then, if you want to trace login calls to your system, find them in the log.
Currently I am working on a project where a web page will start a 3 hour data transfer process through the use of a web service. Basically a list of Id's are used to tell the web service to transfer an data object from one database to another.
When I start the process, I would like to allow the user to remain in control. He must be able to see how far the current process is, and be able press a cancel button to stop the data transfer. All this is run from an ASPX web page.
I have discovered that trying to run the process asynchronous does not allow me to update the user interface as I had hoped. Only when the entire process is finished Another problem I might face is that since the process takes a lot of time, the server objects might get refreshed at some point, which could cause me to lose my progress.
I am currently at the point where I am deciding whether or not to use the web server to process the data transfer. If I am, my current solution is to use tasks to run the process asynchronously, and use client side web calls (to the aspx page) to update the client interface. I am also implementing the IRegisteredObject interface for my work object. IRegisteredObject explanation
Any idea on how to best tackle this problem is most welcome. I really want to know if I'm heading in the right direction.
My suggestion would be for you to create a WCF service, which is not hosted within ASP.NET and to make your ASP.NET application call that service to trigger the long running job that performs the data transfer. Meanwhile your ASP.NET app notifies the user that it has triggered the job and you can expose other endpoints on your service which the ASP.NET application can query through a user request in order to extract and report progress.
The web server will only run one page at a time for each user, so if you want to communicate with the browser while the process is running, you can't run the progress from a request. You need to start it as an independent background thread, so that you can finish the request that started the process.
After that you can send requests to the server either to do polling for status of the process, or to control the process.
If possible you should run the process entirely outside of IIS, for example as a console application. That way you only have to keep track of the fact that there is a process running in the web application, for example putting that in a database so that it survives IIS recycling.
I am coding an ASP.NET MVC 3 app. When a user logs in I need to check a remote system and get the latest data for that user from the system. This task will take approx 15 seconds.
The user should be able to enter my app straight after their login (not have to wait for 15s for the remote call!). When the remote call completes the users local information will be updated.
I was thinking of using a thread to do this, creating it after they have logged in and letting it run its course. However, after reading around, I am concerned about recycling etc when working with threads in MVC. I would use an async controller, but I dont need to feedback to the user the state of this background process. Am I right to be concerned about threads, even if they are short-lived?
"...concerned about recycling..."
"...don't need to feedback to the user the state..."
"...short-lived..."
3 reasons why you should be using ThreadPool.QueueUserWorkItem.
Do not use "threads" in an web app. Let the server handle this by using "async" calls.
Otherwise you would have to setup a threadpool and que the slow request.
I remember I could easily do this in PHP but can't seem to find an answer for ASP.Net. I have a web app that connects to Pop3 server to download emails when a user clicks a button or at set intervals. This process can take a very long time to finish depending on the number of emails to be downloaded. I noticed that when I click the browser stop button the process still continues to download emails preventing the user from navigating to another page. I have tried Response.IsClientConnected property but it doesn't seem to be working.
Any help would be highly appreciated.
You can't. The stop button in the browser will only stop rendering the response. The server however, will keep building the response till it's complete.
I have already opened a webpage in Firefox which is actually running through the apache web server on the same machine. And I have C# application running on the same machine.
Now I want to refresh/inform my already open web page that C# has finished processing.
I have seen the threads all over the web and also some similar threads on Stackoverflow but did not find solution.
Any idea how to solve this?
In details: C# Application is transferring images from external storage. Web page (http://127.0.0.1/mypage.php) is looking for the images periodically, but never know that all images are transferred or not so that it can process these images to do some more work.
In this scenario, we want to tell our web page (which is already running in firefox) all data transferred and now you can refresh to process data.
Two steps: Let the server communicate that C# is done, and have the web page react to it
You somehow need to expose the fact that the C# program has finished to the web. If you also have an IIS running, this could be done via a URL served by IIS directly that returns a value indicating whether C# is still running or not. If you don't, you can write to a file, database or whatever and have a script on your Apache server that checks for this value. Whatever you choose, you want something like www.myserver.com/are_you_finished.[php, aspx, whatever] that returns 1 or 0
Then, you can build JavaScript script in your client page that periodically checks this URL and reacts as soon as the value is 1. This would be a typical AJAX call, ie you need to play with XmlHttpRequest. This could be elaborated much further, but maybe you first say if that's what you have in mind, and I also think there's a lot of good documentation on how to do this on here.
You can include a Internet Explorer control in ouyr appliacation. This way you can control which page is displayed and you can call refresh and whatever you want.
Another way is to include a meta refresh tag in the html page so it periodically looks for updates and refreshes ifself.
I see no way to remote control firefox. The only thing i could think of is remember the process id when you start firefox, and the you kill the process and start a new window, but I consider this bad style.