如何在 C# 窗口应用程序中实现注销功能?

发布于 2024-08-25 03:33:32 字数 268 浏览 3 评论 0原文

我正在用 C# 开发智能设备应用程序。它是一个窗口应用程序。在此应用程序中,我使用登录表单来验证用户身份。只有经过身份验证的用户才能登录系统。我在此应用程序中使用 statc 变量,以便可以在应用程序级别使用它们。部署应用程序后,我可以看到模拟器提供了带有乘法符号的关闭按钮。这样我就可以关闭我的表格和应用程序。但我想在我的应用程序中提供一个注销链接。我可以在 C# 窗口应用程序中提供注销功能吗?如果是,该怎么做?请确保.net框架的所有功能都不能与.net紧凑框架一起使用?您能给我提供可以解决上述问题的代码或链接吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪异←思 2024-09-01 03:33:32

这将取决于登录在您的系统中实际执行的操作。您可能只需要清除这些静态变量(将它们设置为空) - 并确保在使用它们的任何地方,首先测试空值,以便可以检测注销。或者,您可能需要明确终止与服务器的会话。我们确实没有足够的信息来继续。

如果您也控制服务器(我假设某处有一个服务器),那么最好将其设置为无状态(因此没有“会话”可言)或让会话自动超时 - 请记住,在移动设备上,连接很可能是间歇性的;当用户无法告诉服务器他们已经完成时,您不想让昂贵的资源闲置。

我实际上无法为此提供任何代码,因为您没有告诉我们任何真正建议任何代码的信息。如果您提供有关您正在登录的内容等的更多信息,我们也许能够提供更多帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文