Post: C# Simple Login Tutorial
08-09-2013, 02:19 PM #1
Pichu
RIP PICHU.
(adsbygoogle = window.adsbygoogle || []).push({});

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

SnaY, SNMT| Havoc
08-09-2013, 06:25 PM #2
Master Ro
I make food
Originally posted by Pichu View Post


You shouldn't hardcode passwords/usernames (sensitive information) into the program.

Instead, save them in a resources file Smile

Nice tutorial though Winky Winky
08-09-2013, 06:50 PM #3
Pichu
RIP PICHU.
Originally posted by Master
You shouldn't hardcode passwords/usernames (sensitive information) into the program.

Instead, save them in a resources file Smile

Nice tutorial though Winky Winky


Notice the tutorial: Simple.

Either way, a resource file or within the program would be as efficient. If someone wanted in, they would be able to modify the resource file (even if you encrypt in AES) since they have your key within the program. Since you have two constants, you can't modify them during run-time so you would need to modify/rebuild the program or else enter in the correct value which is then hashed and checked.

If I was going to do anything though, I'd go through a server and keep all the hashes on that and return boolean values therefore the information is hidden or at the very least, can't be modified by the user.

I'm making C# tutorials now so if you have anything you might like to see; I will look into making it.
08-09-2013, 08:08 PM #4
Harry
Former Staff
Thank you for tutorial, made sense to me Smile. Hopefully I will be improving!
08-09-2013, 09:06 PM #5
Pichu
RIP PICHU.
Originally posted by Harry View Post
Thank you for tutorial, made sense to me Smile. Hopefully I will be improving!


If you need specific tutorials, I'll look into making them. I'm planning on releasing as many as I can think of and can do in my free time.

I'm also going to use this channel for other things such as gameplays and such so if you want to stay up to date, feel free to subscribe. ^_^
08-09-2013, 10:01 PM #6
Any chance you could make a tutorial for a registration form? Such as the program would open with a form saying something like "enter your product key" and they would have to get one by doing something. All the "product keys" would be on a database where once one is entered it can't be used again after.
08-10-2013, 01:08 AM #7
Pichu
RIP PICHU.
Originally posted by T
Any chance you could make a tutorial for a registration form? Such as the program would open with a form saying something like "enter your product key" and they would have to get one by doing something. All the "product keys" would be on a database where once one is entered it can't be used again after.


Go into further detail.

If you gets steps as to the process that you are hoping to achieve, I can see about writing something up.

I've literally gone over what you stated and have thought up of 10+ different possible methods to this that end up with a similar result but occur differently, some being more difficult than the other.
08-10-2013, 06:59 PM #8
I'd like to create a license form, I can do that, but I want it to only accept codes once and have those codes to be fed off of a webpage database.
08-10-2013, 09:43 PM #9
Master Ro
I make food
Originally posted by Pichu View Post
Notice the tutorial: Simple.

Either way, a resource file or within the program would be as efficient. If someone wanted in, they would be able to modify the resource file (even if you encrypt in AES) since they have your key within the program. Since you have two constants, you can't modify them during run-time so you would need to modify/rebuild the program or else enter in the correct value which is then hashed and checked.

If I was going to do anything though, I'd go through a server and keep all the hashes on that and return boolean values therefore the information is hidden or at the very least, can't be modified by the user.

I'm making C# tutorials now so if you have anything you might like to see; I will look into making it.


Even if a program simple, you should use good practice. By putting them in a resource file, you save yourself multiple magic string problems.

It makes your code neater and easier to read.

Although it isn't necessary for this program, it is better for bigger programs like it.
08-10-2013, 09:55 PM #10
Pichu
RIP PICHU.
Originally posted by Master
Even if a program simple, you should use good practice. By putting them in a resource file, you save yourself multiple magic string problems.

It makes your code neater and easier to read.

Although it isn't necessary for this program, it is better for bigger programs like it.


This is just an example of something simple. There is good practice in everything but you need to look at the situation at hand. If one was to ultimately handle user information that allowed for registration, the best method would be to handle it all on a server where the information is stored, that way that information is kept from the users.

Putting things in a resource file, example, minecraft; where the password is stored is one thing. The problem with that is that if a user wanted access to that file and the contents, they would easily be able to reflect your program and access the data of that file by reversing your encryption or just following how you decrypt it within the program.

Code being easier to read, if you code in user login details within an application; it's not hard to make it neat. If anything, you can create a list that has a corresponding list

It's all about the situation though, please understand that.

If I was truly going to create a program that required login, I'd still just create an output file using SQL.

The reason why I am saying the above is because these are the arguments you will hear. One thing is not always best; it's all based upon the situation.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo