Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
1.18/5 (8 votes)
I wish to create a application before we use the application . It should ask for username password . How to create it . A tutorial or thoughts would help
Posted
Updated 23-May-19 20:32pm
Comments
Member 8575288 17-Jan-12 15:37pm    
i want to create a website that allows users to log in, create new members and change password of d user.

You don't need an application to start an application. Just create a form, set as the default form, to asks for crendentials, authenticates against whatever crendential store you are using, and redirects to the main application page.

What have you tried so far? You need to show a little more initiative than this.

If you don't have a database configured you can use this http://msdn.microsoft.com/en-us/library/x28wfk74.aspx[^] Although it is mainly for ASP.NET, it can be used for any application. The SqlMembershipProvider[^] can handle your authentication.
 
Share this answer
 
v2
Comments
steven8Gerrard 4-Aug-11 8:20am    
Created a login page using XML. But i wish to create a login where four different users can login . Say user1 has access to all features whereas user2 has limited features stuffs like that . Created a login page using xml.
[no name] 4-Aug-11 8:30am    
What does XML have to do with this? Does your crendential store also provide role management? You limit feature availability by using roles.
Praveen Kullu 4-Aug-11 10:17am    
Are you storing user names and passwords in an XML file?
I won't suggest you to store names and password in xml file,since it can be easily changed by anyone.

For WinForms, here is my solution. If you have learnt Sql Server or any other RDBMS language, then:
1.Create a table in database.
2.The table will store username and password in it.

Now create a Winform. Add 2 textboxes and a button to form. Make the form primary form. In the form properties, set,
1. StartPosition = CenterScreen.
2. ShowInTaskbar = False
3. FormBorderStyle = none

The textboxes will ask for username and password. In the event for button_click, the username and password will be checked in the table.(If you have learnt SQlServer or any other RDBMS language, you will know how to check).
Only when the user name and password match, the form asking for username and password will be closed, and new form which you want to show, will be visible.

If you are still unclear about anything, then ask again.
 
Share this answer
 
Comments
[no name] 4-Aug-11 11:25am    
There is already a database available, no need to create one
http://msdn.microsoft.com/en-us/library/x28wfk74.aspx
Praveen Kullu 4-Aug-11 11:53am    
Obviously i didn't knew that. But how tough is creating a table?
Probably this article will help: ASP.NET Forms Authentication - Part 1
In other words:
1. You should configure web app to use forms authentication;
2. You should check crentials and set auth token for user if all is correct;
You could use your custom logic & design or use login control. In most complex case you even could create custom membership provider.
 
Share this answer
 
Comments
[no name] 4-Aug-11 10:13am    
This is not a web app. Doesn't anyone read the question or tags?
Vitaly Obukhov 4-Aug-11 10:34am    
You didn't specified type of your app. Login form is mostly used in web applications. Have you any particular problems with this task? If not then just separate your athentication logic from view (form), implement authentication logic and form itself.
[no name] 4-Aug-11 10:47am    
Look at the TAGS under the question title. It was specified.

Login forms are not just for web applications.
 public static void Main()
    {
       string username, password;
       int ctr = 0;
       Console.Write("\n\nCheck username and password :\n");
	   Console.Write("N.B. : Default user name and password is :abcd and 1234\n");
       Console.Write("------------------------------------------------------\n"); 
         
        do
        {
			Console.Write("Input a username: ");
			username = Console.ReadLine();
 
			Console.Write("Input a password: ");
			password = Console.ReadLine();
			
             if(username != "abcd" || password != "1234")
             ctr++;
             else
             ctr=1;
     
        }
        while((username != "abcd" || password != "1234")  && (ctr != 3));
	 
        if (ctr == 3)
            Console.Write("\nLogin attemp three or more times. Try later!\n\n");
        else   
            Console.Write("\nThe password entered successfully!\n\n");		
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900