That depends on what you really need.
In my case I created a class (ActionRunner... and later a RunnableRunner). I use a Thread from my own pool of threads. It waits for a new Action (using a ManagedAutoResetEvent) and uses a Queue to effectively queue the Actions.
So, while there are items in the queue they are executed. When there are no more, an wait is done. My own ActionRunner is disposable, but that's to guarantee that I free the thread at the right moment. I consider it the best solution as it does not creates an unnecessary window and because the messages are real .Net actions (and not some number that must be processed by a switch).
Hi! How to end session after logging out? I am facing a problem that when clicking on logout session ends. After clicking on back button, previous page repeats again. This happens in all the pages of my project.
Here is the code for logout link..
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
You are successfully killing the session there, so the previous page should no longer be active. (That is, nothing on it should work, because there will be no valid session for any action, and F5ing it should result in a failed authorisation and a return to the login page.)
What you need to do if you don't want browsers to show the page is make all your secure pages uncacheable. To do this in all browsers I think you need to set Pragma: no-cache, Cache-Control: none and also Expires: to a date in the past.
I have two links in my home page namely Register & Login. They are kept in a panel control and when I press enter from login popup it should be login. Till now every thing works.
When clicking on them(links) individually two modalpopups shown. When I press esc button they should be closed. But it is not working in a panel if I give BehaviorID to popup. Can any one help me?
Here is the asp.net code....
//closes the popup by pressing the esc button on the keyboard
document.onkeyup = Escape;
var KeyID = event.keyCode;
if (KeyID == 27)
else if ($find("MPEloginescclose"))
Don't. If you have a recordId, assume it exists and delete it - catch the exception if it did not. Adding checks like the one you proposed might say it exist, and still be deleted (by someone else) an instance later (unless it's an atomic operation, which I doubt).
if you delete it while it doesn't exist SQL will return something like: "0 rows deleted".
Deletefrom tableX where myconstraint='Myconstraint';
--> query returned in 10 ms: 0 rows deleted
If you do it in code you can get that by reading out the NrOfRowsAffected property when doing an ExecuteNonQuery statement. Same goes for Insert and Update queries eg.
as someone already replied, checking if it exists is inaccurate at best and doesn't add any functional advantage.
if you really, really must check it. Perform a select query perhaps with a count.
Select count(id) from tableX where myconstraint='Myconstraint'
This is your project to do. What's the point of us writing your code for you, as you learn nothing and you will be ill suited to becoming a professional developer. The trick is to research the algorithm yourself, and break it down little bit by little bit. A trick I sometimes use to help is to talk an algorithm through with someone - once you try and explain it, you see where the gaps are in your knowledge and it becomes easier to tackle those areas.
I was brought up to respect my elders. I don't respect many people nowadays.
My application constructs a message with a header class and a Datastream in the body, it queues it for a central message distribution service which inturn queues it for other applications of mine to read - all via MSMQ with security set to None.
The CMDS is perfectly able to read the message from App 0, but it repeatedly fails to requeue it for App 1 etc.
But not consistently! Sometimes after clearing / deleting the queues it will work for a couple of times and then fails again.
The logic to queue form App 0 to the CMDS which rarely fails is replicated almost exactly in the CMDS to queue to the other Applications - but it hardly ever works!
I need to revisit the code to improve transaction handling but if that resolves the matter it will be accidental!