Post: [C#] How to make a Login Panel
11-10-2014, 12:45 PM #1
Swaqq
Professional Thanker
(adsbygoogle = window.adsbygoogle || []).push({}); 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

The following 12 users say thank you to Swaqq for this useful post:

Boliberrys, Father Luckeyy, iRnZ, Norway-_-1999, PhucedMODZ, Pichu, RTE, Kronos, Smooth, Laser, xDebugKiller, ZerthekModz
11-10-2014, 01:23 PM #2
Smooth
< ^ > < ^ >
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:

The following user thanked Smooth for this useful post:

Swaqq
11-10-2014, 05:41 PM #3
Have you got skype?
11-10-2014, 07:01 PM #4
Pichu
RIP PICHU.
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

The following 2 users say thank you to Pichu for this useful post:

MrRa1n, Swaqq
11-24-2014, 09:50 PM #5
SunnyTehFunny
Climbing up the ladder
Please add me on skype.. need your help
Skype addy: dj-sunnyfreak
05-01-2016, 10:00 PM #6
how did you create a login page on x10hosting??
05-06-2016, 07:38 PM #7
Jim Halpert
Bounty hunter
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
10-30-2016, 01:38 PM #8
Good but is not secure
10-31-2016, 06:35 AM #9
Mr Smithy x
Former Staff
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.
11-01-2016, 04:03 PM #10
Originally posted by Mr
Swaqq makes the most secure applications on the forum. This is 100x better than google's security team.


:putin:

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo