点击回车键后,asp web项目注销? [英] asp web project logout when click enter key ?

查看:52
本文介绍了点击回车键后,asp web项目注销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



当我点击任意位置输入密钥时我的asp web项目注销?



请问我该如何解决?







谢谢?:)

hi all

my asp web project logout when i click enter key any where ?

please how can i solve it ?



thanks ?:)

推荐答案

您希望人们通过按Enter键来注销您的Web应用程序,无论他们在您的网站中的位置如何?



在我看来,这听起来像个糟糕的主意。但是,您必须在Web应用程序中的任何位置实现onkeydown事件。

http://www.w3schools.com/jsref/event_onkeydown.asp [ ^ ]



然后,您可以检查Enter键并重定向到注销页面。
You want people to logout of your web app by hitting the enter key no matter where they are in your web site?

In my opinion, that sounds like a terrible idea. However, you'll have to implement the onkeydown event everywhere in your web app.
http://www.w3schools.com/jsref/event_onkeydown.asp[^]

You can then check for the Enter key and redirect to a logout page.


我记得的问题是ASP.NET团队提供的ASP.NET模板在ASP.NET 4中,使用表单注销用户。我下载学习ASP.NET的模板具有相同的功能,我总是讨厌为什么他们必须将表单提交到可以使用超链接的页面。表格就像(如果我记得很清楚)



The problem that I can remember of is that ASP.NET templates provided by ASP.NET teams in ASP.NET 4, used a form to logout the users. The template that I downloaded to learn ASP.NET had the same thing and I always hated why did they have to submit a form to a page where they could use the hyperlink. The form was something like (if I remember clearly)

<form method="post" id="form" action="~/Logout.cshtml">
   <a href="javascript:document.getElementById('#form').submit()">Logout</a>
</form>





也许,您正在提交该登出表单(超链接可能是活动的,标签焦点或其他)。这反过来又会导致用户退出。我建议你调试你的应用程序,看看出了什么问题。即使在你的情况下上述情况属实,即使这样,也不能隐含地将回车键设置为它。



Perhaps, you are submitting that logout form (the hyperlink may be active, tab focus or whatever). Which in turn logs out the user. I would recommend that you debug your application and see what is going wrong. Even if the above case is true in your case, even then the enter key must not be set to it, implicitly.


这篇关于点击回车键后,asp web项目注销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆