Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. save or register password for next login form ...

save or register password for next login form ...

Scheduled Pinned Locked Moved C#
help
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N nassimnastaran

    Hi every one ! I have two form : First Form for enter username and pass and Form2(Main Form). I want to save or register password and username if the user enter a valid pass . And for the next time , if the user execute this app , go to the main form directly. (because for the first time he enter a valid pass). thanks for any help !

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    nassimnastaran wrote:

    thanks for any help !

    Help with what exactly?

    Bastard Programmer from Hell :suss:

    1 Reply Last reply
    0
    • N nassimnastaran

      Hi every one ! I have two form : First Form for enter username and pass and Form2(Main Form). I want to save or register password and username if the user enter a valid pass . And for the next time , if the user execute this app , go to the main form directly. (because for the first time he enter a valid pass). thanks for any help !

      A Offline
      A Offline
      amargujrathi2006
      wrote on last edited by
      #3

      You can store user's pwd in registry by using Microsoft.Win32.RegistryKey class.

      N 1 Reply Last reply
      0
      • A amargujrathi2006

        You can store user's pwd in registry by using Microsoft.Win32.RegistryKey class.

        N Offline
        N Offline
        nassimnastaran
        wrote on last edited by
        #4

        thanks, for ur guide! here is my code :

        using Microsoft.Win32;
        ...
        else if (.....)
        {
        RegistryKey mypass =
        Registry.CurrentUser.CreateSubKey("mypass");
        using (RegistryKey
        myName = mypass.CreateSubKey("myName"),
        mySettings = mypass.CreateSubKey("mySettings"))
        {
        mySettings.SetValue("mypass", "Secret");
        }
        WorkForm.ShowDialog();
        }

        but it don't create anything in HKEY_CURRENT_USER in RegEdit . thanks !

        D 1 Reply Last reply
        0
        • N nassimnastaran

          thanks, for ur guide! here is my code :

          using Microsoft.Win32;
          ...
          else if (.....)
          {
          RegistryKey mypass =
          Registry.CurrentUser.CreateSubKey("mypass");
          using (RegistryKey
          myName = mypass.CreateSubKey("myName"),
          mySettings = mypass.CreateSubKey("mySettings"))
          {
          mySettings.SetValue("mypass", "Secret");
          }
          WorkForm.ShowDialog();
          }

          but it don't create anything in HKEY_CURRENT_USER in RegEdit . thanks !

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #5

          Saving the users password in clear text in the registry? Now if THAT's not a security risk, I don't know what is.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          N 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Saving the users password in clear text in the registry? Now if THAT's not a security risk, I don't know what is.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak

            N Offline
            N Offline
            nassimnastaran
            wrote on last edited by
            #6

            in fact I want to save pass in registry system (and whenever the user execute app. , the mainform displayed directly). thanks!

            D 1 Reply Last reply
            0
            • N nassimnastaran

              in fact I want to save pass in registry system (and whenever the user execute app. , the mainform displayed directly). thanks!

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #7

              So what?? You NEVER EVER EVER EVER store a password in the registry. If you have a user that is logged in, you flag that the user is logged in on the server side. You also keep a piece of data the client sends to the server that says the client is logged in on that particular machine. This keeps the client secured so the password cannot be stolen.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak

              N 1 Reply Last reply
              0
              • D Dave Kreskowiak

                So what?? You NEVER EVER EVER EVER store a password in the registry. If you have a user that is logged in, you flag that the user is logged in on the server side. You also keep a piece of data the client sends to the server that says the client is logged in on that particular machine. This keeps the client secured so the password cannot be stolen.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak

                N Offline
                N Offline
                nassimnastaran
                wrote on last edited by
                #8

                Thanks Dave ,and You Are Right , But it's only an application(windows form) that execute in the local machin (there is no server for this).

                D 1 Reply Last reply
                0
                • N nassimnastaran

                  Thanks Dave ,and You Are Right , But it's only an application(windows form) that execute in the local machin (there is no server for this).

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #9

                  Then what's the point of logging in??

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak

                  N 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    Then what's the point of logging in??

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak

                    N Offline
                    N Offline
                    nassimnastaran
                    wrote on last edited by
                    #10

                    I create an App. that's execute in PC and I want to avoide to any copy from the App. so in the form1 I set to get the CPU ID , so after the user call me to get the Pass , he can Open to the Main Form . So the pass must be save in a file or registry system , until , whenever he want to execute the app. , Main form open ... . ( this is my story ;)

                    D 1 Reply Last reply
                    0
                    • N nassimnastaran

                      I create an App. that's execute in PC and I want to avoide to any copy from the App. so in the form1 I set to get the CPU ID , so after the user call me to get the Pass , he can Open to the Main Form . So the pass must be save in a file or registry system , until , whenever he want to execute the app. , Main form open ... . ( this is my story ;)

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #11

                      nassimnastaran wrote:

                      and I want to avoide to any copy from the App.

                      There's no such thing as copy protection that actually works. CPU ID is disabled by default on most systems because of privacy concerns and is not even implemented on the newest Intel CPUs and AMD never implemented it at all on any of there CPU's. So, CPUID is useless as an identifier. What you're talking about is a registration key. This is normally encrypted and stored in the registry in several locations. When the app is run (no login form required) the value is read back and decrypted and verified.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups