Skip to content

Instantly share code, notes, and snippets.

@miklund
Created December 21, 2015 15:19
Show Gist options
  • Save miklund/1afdbab7c1c6cf7f5084 to your computer and use it in GitHub Desktop.
Save miklund/1afdbab7c1c6cf7f5084 to your computer and use it in GitHub Desktop.
2009-03-02 Where do you want to goto today?
# Title: Where do you want to goto today?
# Author: Mikael Lundin
# Link: http://blog.mikaellundin.name/2009/03/02/where-do-you-want-to-goto-today.html
public void LogIn(ILoginService client, string username, string password)
{
int attempt = 0;
LoginAttempt:
try
{
client.OpenConnection();
client.Authenticate(username, password);
}
catch (SecurityException)
{
if (attempt++ < 3)
goto LoginAttempt;
throw;
}
finally
{
client.CloseConnection();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment