c# - Error trying to login a hardcoded account -


i have 2 textbox type usename , password. 1 button login. login pass if username , password correct, have error @ part when username , password wrong. got

error 1 syntax error, '(' expected

and

error 2 ) expected

below codes in login button.

if (txtuser.text == "jon" && txtpass.text == "any") {     response.redirect("admin.aspx"); } if else (txtuser.text == "" && txtpass.text == "") {     lblerror.text = "invalid user or pass"; } 

reverse if else - that'll give syntax error.

if (txtuser.text == "jon" && txtpass.text == "any") {     response.redirect("admin.aspx"); } else if (txtuser.text == "" && txtpass.text == "") {     lblerror.text = "invalid user or pass"; } 

for purpose of test can remove part:

if (txtuser.text == "" && txtpass.text == "") 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -