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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -