Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
hi all

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

please how can i solve it ?



thanks ?:)
Posted
Comments
Richard Deeming 2-Nov-15 13:38pm    
By fixing your code so that it doesn't log out when you press the Enter key.

Since you haven't shown any of your code, we can't tell you how to fix it.
sam9787 2-Nov-15 13:44pm    
man
my problem is when i click Enter key from keyboard the web site logout ...
so how can i disable Enter Key from my site ?
Richard Deeming 2-Nov-15 13:55pm    
By fixing your code so that it doesn't log out when you press the Enter key.

Since you haven't shown any of your code, we can't tell you how to fix it.

And yes, this is the same comment I posted 15 minutes ago. Because you STILL haven't shown any of your code.

We cannot see your screen. We cannot access your computer. We cannot read your mind.

If you don't show us any code, we cannot help you.
Sergey Alexandrovich Kryukov 2-Nov-15 14:36pm    
The question makes no sense at all, even after the clarifications you provided in a comment to Solution 1.
—SA

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.
 
Share this answer
 
Comments
sam9787 2-Nov-15 13:45pm    
no
i dont want people to logout from web site when click Enter Key ....
this is my problem !!!!
ZurdoDev 2-Nov-15 13:54pm    
Why is it logging out when someone clicks Enter? There's no way for us to know since we can't see anything that you have done.
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)

HTML
<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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900