THREAD: [C#] How to make a Login Panel
  1. 11-10-2014, 12:45 PM
    Swaqq's Avatar
    Swaqq
    Professional Thanker
    Swaqq's Avatar
    Swaqq
    Professional Thanker
    800
    Posts
    17,079
    Reputation
    Nov 2013
    NextGenUpdate
    yo guys this is a quick tutorial on how to make a login form in C#. This will require website hosting. I recommend x10Hosting.

    1: Make a new solution in C# Called anything you want.

    2: At the top of your solution, add "using System.Net;"
    You must login or register to view this content.

    3: Make a form design that looks something like this:
    You must login or register to view this content.

    4: Go to your textbox2(or the textbox you are using for your password) properties and change the PasswordChar to "●"
    You must login or register to view this content.

    5: Double click on the login button and insert the following above the button code.


    public string MemberListLink = "https://swaqqdemologin.x10host.com/LoginInfo/";
    public string str;

    public void Login(string username, string password)
    {

    if (username == "" && password == "")
    {
    MessageBox.Show("Please enter your Username and Password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else if (username == "")
    {
    MessageBox.Show("Please Enter your username", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else if (password == "")
    {
    MessageBox.Show("Please Enter your password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else
    {
    WebClient MemString = new WebClient();
    try { str = MemString.DownloadString(MemberListLink); }
    catch { MessageBox.Show("Error Connecting to Server"); }
    if (str.Contains(username + "+" + password))
    MessageBox.Show("Logged In", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
    else MessageBox.Show("Wrong username or Password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    }


    In the end it should look like:
    You must login or register to view this content.

    Change my link to your hosting.

    6: On your Login button code, write the following
    You must login or register to view this content.
    Textbox1 and 2 are username and pass, you can change them to the name of your textboxes.

    7: Go to your file manager on your hosting and make a new file like so:
    You must login or register to view this content.

    Then you will make your username and password to the following:
    You must login or register to view this content.

    Then press here:
    You must login or register to view this content.

    If you have done everything correctly, you should be able to launch the app and login:
    You must login or register to view this content.

    Thanks for reading :3 BTW I'm still making a sign up so yea.

    -Cya
  2. The Following 12 Users Say Thank You to Swaqq For This Useful Post:

    , , , , , , , , , , ,

  3. 11-10-2014, 01:23 PM
    Smooth's Avatar
    Smooth
    < ^ > < ^ >
    Smooth's Avatar
    Smooth
    < ^ > < ^ >
    1,109
    Posts
    8,711
    Reputation
    Oct 2013
    NextGenUpdate
    Originally Posted by Swaqq View Post
    yo guys this is a quick tutorial on how to make a login form in C#. This will require website hosting. I recommend x10Hosting.

    1: Make a new solution in C# Called anything you want.

    2: At the top of your solution, add "using System.Net;"
    You must login or register to view this content.

    3: Make a form design that looks something like this:
    You must login or register to view this content.

    4: Go to your textbox2(or the textbox you are using for your password) properties and change the PasswordChar to "●"
    You must login or register to view this content.

    5: Double click on the login button and insert the following above the button code.


    public string MemberListLink = "https://swaqqdemologin.x10host.com/LoginInfo/";
    public string str;

    public void Login(string username, string password)
    {

    if (username == "" && password == "")
    {
    MessageBox.Show("Please enter your Username and Password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else if (username == "")
    {
    MessageBox.Show("Please Enter your username", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else if (password == "")
    {
    MessageBox.Show("Please Enter your password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else
    {
    WebClient MemString = new WebClient();
    try { str = MemString.DownloadString(MemberListLink); }
    catch { MessageBox.Show("Error Connecting to Server"); }
    if (str.Contains(username + "+" + password))
    MessageBox.Show("Logged In", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
    else MessageBox.Show("Wrong username or Password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    }


    In the end it should look like:
    You must login or register to view this content.

    Change my link to your hosting.

    6: On your Login button code, write the following
    You must login or register to view this content.
    Textbox1 and 2 are username and pass, you can change them to the name of your textboxes.

    7: Go to your file manager on your hosting and make a new file like so:
    You must login or register to view this content.

    Then you will make your username and password to the following:
    You must login or register to view this content.

    Then press here:
    You must login or register to view this content.

    If you have done everything correctly, you should be able to launch the app and login:
    You must login or register to view this content.

    Thanks for reading :3 BTW I'm still making a sign up so yea.

    -Cya


    Nice n00b15torial Enzo :wub:
  4. The Following User Thanked Smooth For This Useful Post:


  5. 11-10-2014, 05:41 PM
    18
    Posts
    10
    Reputation
    Nov 2013
    NextGenUpdate
    Have you got skype?
  6. 11-10-2014, 07:01 PM
    Pichu's Avatar
    Pichu
    RIP PICHU.
    Pichu's Avatar
    Pichu
    RIP PICHU.
    6,550
    Posts
    34,645
    Reputation
    Jan 2011
    NextGenUpdate
    Localize your variables.

    Also, TextBoxes have a property for whether or not it is passwords or not. It's a bool property. [UseSystemPasswordChar]

    Advice, never leave username/password on your database plaintext, get the SHA1 or SHA256 [hash it if you want too].

    On your host, hash your username/password. On your program, you then hash the input and match. Since it is not plaintext, it is harder to steal since where it stands, it can be reflected.

    If you know PHP, you can take authentication a little bit further.

    Still, a nice basic tutorial. Smile
  7. The Following 2 Users Say Thank You to Pichu For This Useful Post:

    ,

  8. 11-24-2014, 09:50 PM
    SunnyTehFunny's Avatar
    SunnyTehFunny
    Climbing up the ladder
    SunnyTehFunny's Avatar
    SunnyTehFunny
    Climbing up the ladder
    471
    Posts
    1,123
    Reputation
    Aug 2014
    NextGenUpdate
    Please add me on skype.. need your help
    Skype addy: dj-sunnyfreak
  9. 05-01-2016, 10:00 PM
    204
    Posts
    350
    Reputation
    Sep 2014
    NextGenUpdate
    how did you create a login page on x10hosting??
  10. 05-06-2016, 07:38 PM
    Jim Halpert's Avatar
    Jim Halpert
    Bounty hunter
    Jim Halpert's Avatar
    Jim Halpert
    Bounty hunter
    158
    Posts
    2,404
    Reputation
    Aug 2011
    NextGenUpdate
    Originally Posted by Swaqq View Post
    yo guys this is a quick tutorial on how to make a login form in C#. This will require website hosting. I recommend x10Hosting.

    1: Make a new solution in C# Called anything you want.

    2: At the top of your solution, add "using System.Net;"
    You must login or register to view this content.

    3: Make a form design that looks something like this:
    You must login or register to view this content.

    4: Go to your textbox2(or the textbox you are using for your password) properties and change the PasswordChar to "●"
    You must login or register to view this content.

    5: Double click on the login button and insert the following above the button code.


    public string MemberListLink = "https://swaqqdemologin.x10host.com/LoginInfo/"; public string str;

    public void Login(string username, string password)
    {

    if (username == "" && password == "")
    {
    MessageBox.Show("Please enter your Username and Password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else if (username == "")
    {
    MessageBox.Show("Please Enter your username", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else if (password == "")
    {
    MessageBox.Show("Please Enter your password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else
    {
    WebClient MemString = new WebClient();
    try { str = MemString.DownloadString(MemberListLink); }
    catch { MessageBox.Show("Error Connecting to Server"); }
    if (str.Contains(username + "+" + password))
    MessageBox.Show("Logged In", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
    else MessageBox.Show("Wrong username or Password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    }


    In the end it should look like:
    You must login or register to view this content.

    Change my link to your hosting.

    6: On your Login button code, write the following
    You must login or register to view this content.
    Textbox1 and 2 are username and pass, you can change them to the name of your textboxes.

    7: Go to your file manager on your hosting and make a new file like so:
    You must login or register to view this content.

    Then you will make your username and password to the following:
    You must login or register to view this content.

    Then press here:
    You must login or register to view this content.

    If you have done everything correctly, you should be able to launch the app and login:
    You must login or register to view this content.

    Thanks for reading :3 BTW I'm still making a sign up so yea.

    -Cya


    canihaveyourskypecanihaveyourskypecanihaveyourskype
  11. 10-30-2016, 01:38 PM
    Phrezus's Avatar
    Phrezus
    Keeper
    Phrezus's Avatar
    Phrezus
    Keeper
    10
    Posts
    10
    Reputation
    Oct 2016
    NextGenUpdate
    Good but is not secure
  12. 10-31-2016, 06:35 AM
    Mr Smithy x's Avatar
    Mr Smithy x
    Former Staff
    Mr Smithy x's Avatar
    Mr Smithy x
    Former Staff
    465
    Posts
    12,583
    Reputation
    Nov 2013
    NextGenUpdate
    Originally Posted by Phrezus View Post
    Good but is not secure


    Swaqq makes the most secure applications on the forum. This is 100x better than google's security team.
  13. 11-01-2016, 04:03 PM
    Phrezus's Avatar
    Phrezus
    Keeper
    Phrezus's Avatar
    Phrezus
    Keeper
    10
    Posts
    10
    Reputation
    Oct 2016
    NextGenUpdate
    Originally Posted by Mr View Post
    Swaqq makes the most secure applications on the forum. This is 100x better than google's security team.


    :putin: