• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 455
  • Last Modified:

conver vb.net to c#

' Determine why the user could not login...
     myLogin.FailureText = "Your login attempt was not successful. Please try again."
   
     ' Does there exist a User account for this user?
     Dim usrInfo As MembershipUser = Membership.GetUser(myLogin.UserName)

     If usrInfo IsNot Nothing Then
          ' Is this user locked out?
          If usrInfo.IsLockedOut Then
               myLogin.FailureText = "Your account has been locked out because of too many invalid login attempts. Please contact the administrator to have your account unlocked."
          ElseIf Not usrInfo.IsApproved Then
               myLogin.FailureText = "Your account has not yet been approved. You cannot login until an administrator has approved your account."
          End If
     End If
0
mathieu_cupryk
Asked:
mathieu_cupryk
  • 2
1 Solution
 
HainKurtSr. System AnalystCommented:
use
http://www.carlosag.net/Tools/CodeTranslator/
myLogin.FailureText = "Your login attempt was not successful. Please try again.";
MembershipUser usrInfo = Membership.GetUser(myLogin.UserName);
if (usrInfo) {
    IsNot;
    null;
    //  Is this user locked out?
    if (usrInfo.IsLockedOut) {
        myLogin.FailureText = "Your account has been locked out because of too many invalid login attempts. Please contact the admin" +
        "istrator to have your account unlocked.";
    }
    else if (!usrInfo.IsApproved) {
        myLogin.FailureText = "Your account has not yet been approved. You cannot login until an administrator has approved your acc" +
        "ount.";
    }
}

Open in new window

0
 
HainKurtSr. System AnalystCommented:
oops, serious problems with that site ;)
try this
myLogin.FailureText = "Your login attempt was not successful. Please try again.";
MembershipUser usrInfo = Membership.GetUser(myLogin.UserName);
if (usrInfo != null) {
    //  Is this user locked out?
    if (usrInfo.IsLockedOut) {
        myLogin.FailureText = "Your account has been locked out because of too many invalid login attempts. Please contact the admin" +
        "istrator to have your account unlocked.";
    }
    else if (!usrInfo.IsApproved) {
        myLogin.FailureText = "Your account has not yet been approved. You cannot login until an administrator has approved your acc" +
        "ount.";
    }
}

Open in new window

0
 
Rajar AhmedConsultantCommented:
http://www.developerfusion.com/tools/convert/vb-to-csharp/
myLogin.FailureText = "Your login attempt was not successful. Please try again.";
    
    // Does there exist a User account for this user?
    MembershipUser usrInfo = Membership.GetUser(myLogin.UserName);
    
    if (usrInfo != null) {
        // Is this user locked out?
        if (usrInfo.IsLockedOut) {
            myLogin.FailureText = "Your account has been locked out because of too many invalid login attempts. Please contact the administrator to have your account unlocked.";
        }
        else if (!usrInfo.IsApproved) {
            myLogin.FailureText = "Your account has not yet been approved. You cannot login until an administrator has approved your account.";
        }
    }

Open in new window

0
 
mathieu_cuprykAuthor Commented:
k
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now