Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Creating a password login

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cameljs18@yahoo.com - 04 Feb 2008 13:57 GMT
When i start my windows app i want to have a password screen to come
up then when the user types the correct password then it closes the
password form and opens the mainform.
Marc Gravell - 04 Feb 2008 14:06 GMT
There is nothing special about a password form; I think you need to
find a book or whatever about the fundamentals of showing a form; the
only minor change is you might want to hide the user input (TextBox
has "PasswordChar").

Show the login form; if successful, show the next...? Small example
below, but note that in a non-trivial system you might choose to hold
"am I logged in? as who? with what acces?" by a "Principal", which
means you don't have to track it separately.

       bool loggedIn;
       using (MyLoginForm loginForm = new MyLoginForm())
       {
           loggedIn = loginForm.ShowDialog() == DialogResult.OK;
       }
       if (loggedIn)
       {
           using (MyMainForm mainForm = new MyMainForm())
           {
               // maybe "Application.Run(mainForm)" instead
               mainForm.ShowDialog();
           }
       }
Nicholas Paldino [.NET/C# MVP] - 04 Feb 2008 15:28 GMT
The thing that is not so trivial about this is how you perform the
authentication.  Quite frankly, it's not something that people should
re-implement if we are talking about applications on local machines.  There
is a reason for single-sign on in Windows: there is ^already^ someone logged
in and authorized on the machine

   If this is a web-based app then that is different, because the domain
you are working in is larger than the machine.

   But generally, passwords for local applications are a bad idea, IMO.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> There is nothing special about a password form; I think you need to
> find a book or whatever about the fundamentals of showing a form; the
[quoted text clipped - 19 lines]
>            }
>        }
Ian Semmel - 04 Feb 2008 18:55 GMT
Not really if you are using, say, a mysql database and the
application-level authorizations differ from windows.

> The thing that is not so trivial about this is how you perform the
> authentication.  Quite frankly, it's not something that people should
[quoted text clipped - 37 lines]
> >            }
> >        }
Ignacio Machin ( .NET/ C# MVP ) - 04 Feb 2008 19:41 GMT
Hi,

It depends, if you have an isolated machine that is no connected to any
domain you might want to have auth built into the app itself. Also useful is
when a login is shared among several person and each of these person needs
different access to the app.

Signature

Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.

>    The thing that is not so trivial about this is how you perform the
> authentication.  Quite frankly, it's not something that people should
[quoted text clipped - 30 lines]
>>            }
>>        }
Kbalz - 05 Feb 2008 19:55 GMT
On Feb 4, 2:41 pm, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.com> wrote:
> Hi,
>
[quoted text clipped - 47 lines]
>
> - Show quoted text -

Yep, and in this case as well: We have computers on our shop floor,
they are all logged into the Domain as user name "SHOP" - but each
Employee that uses our application has a real name that we would like
to track via our application. This saves window's user login names,
CAL licenses I think its called?
Nicholas Paldino [.NET/C# MVP] - 06 Feb 2008 21:49 GMT
That's the thing though, in this scenario, you are actually battling the
OS.  There is no reason to have every person logged in as SHOP.  You
basically are throwing away the benefits of having different users on the
network (as well as the ability to put them into groups).

   There is no reason to "save" user login names, because the domain should
be doing it for you in this situation already.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

On Feb 4, 2:41 pm, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.com> wrote:
> Hi,
>
[quoted text clipped - 51 lines]
>
> - Show quoted text -

Yep, and in this case as well: We have computers on our shop floor,
they are all logged into the Domain as user name "SHOP" - but each
Employee that uses our application has a real name that we would like
to track via our application. This saves window's user login names,
CAL licenses I think its called?
Ian Semmel - 04 Feb 2008 18:57 GMT
I think it is a better user experience to have the main window come up
and then the login form.

> When i start my windows app i want to have a password screen to come
> up then when the user types the correct password then it closes the
> password form and opens the mainform.
Ignacio Machin ( .NET/ C# MVP ) - 04 Feb 2008 19:39 GMT
Hi,

In this case all you need to do is create a Modal form, depending of the
return the app (and the main form in the back) close or is activated.

Signature

Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.

>I think it is a better user experience to have the main window come up and
>then the login form.
>
>> When i start my windows app i want to have a password screen to come
>> up then when the user types the correct password then it closes the
>> password form and opens the mainform.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.