views:

185

answers:

1

I am developng Smart device application in C#. It is a window application. In this application I am using Login form to authenticate the users. Only authenticated users can login into the system. I using statc variables in this application so that they can be used at application level. After deploying the application I can see that emulator provides the close button with multiplicaton symbol. In this way I can close my form as well as application. But I want to provde one logout link in my application. Can I provide logout functionality in C# window applicain ? If yes, how to do that ? Please make sure that all the functions of .net framework does not work with .net compact framwork? Can you provide me the code or link through which can resolve the above issue ?

+1  A: 

This will depend on what logging in actually does in your system. You may just need to clear those static variables (set them to null) - and make sure that everywhere you use them, you test for nullity first so you can detect logout. Alternatively, you may need to explicitly expire your session with the server. We don't really have enough information to go on.

If you're in control of the server as well (I'm assuming there is a server somewhere) it would be good to either make it stateless (so there's no "session" to speak of) or make the session time out automatically - bear in mind that on a mobile device, the connection may well be intermittent; you don't want to leave expensive resources hanging around when the user has no way of telling the server that they're finished.

I can't really provide any code for this, as you haven't told us any information which would really suggest any code. If you give more information about what you're logging into etc, we may be able to help more.

Jon Skeet