For some reason, when I am in the password text box, when I press enter, it simply clears both fields. Doesn't validate, doesn't login, just clears the fields. What is going on here?

Codebehind:

PrivateSub cmdLogin_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.ServerClick
If FormsAuthentication.Authenticate(txtUser.Text, txtPass.Text) Then
FormsAuthentication.RedirectFromLoginPage(txtUser.Text, chkPersist.Checked)
Else
lblStatus.Text = "Not Authenticated"
IfCInt(ViewState("Tries")) > 1 Then
Response.Redirect("Denied.aspx")
Else
' Otherwise, increment number of tries.
ViewState("Tries") = CInt(ViewState("Tries")) + 1
EndIf
EndIf
EndSub

And the aspx page is attached. Please help.

Slade

Is the viewstate enabled? Is the page properly posting back? Try putting in a Response.Write somewhere...

clicking on the button actually works but..?

ok clicking on the actual button with the mouse WORKS, but when I hit enter and I'm in the password field, it just clears the form whats the deal? It should just login like when I click it, please help.


Thanks in advance,

Slade

Ah, well, when you hit enter, the button isn't a default button :-P. You'll either need to write some javascript here, or use the free MetaBuilder's DefaultButtons Control.

As always tekmaven you were helpful, that control is awesome. Where do you find out about all of them?

As always tekmaven you were helpful, that control is awesome. Where do you find out about all of them?

Just about every employee that works on .NET at Microsoft has blogs. Just get a good RSS agregator, and check them all. With a little time each day (okay, maybe a lot), I guaruntee you will learn a lot.

And, the thanks for the kind words. Don't forget to share that thought with the member rating system ("reputation").. ;) .

commented: Sorry buddy :P forgot it existed. +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.