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. login from read file.txt

login from read file.txt

Scheduled Pinned Locked Moved C#
securityquestion
17 Posts 5 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.
  • P Pete OHanlon

    Do you mean database, or are you talking about an in memory collection? And I think you mean PIN, not nip - PIN = Personal Identification Number.

    T Offline
    T Offline
    techker2
    wrote on last edited by
    #7

    sorry french.. memory collection sounds like it..

    P 1 Reply Last reply
    0
    • T techker2

      sorry french.. memory collection sounds like it..

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #8

      Don't be sorry about what your native language is. French is a beautiful language, and is one of the cornerstones of modern English. Rejoice in your native speech. Glory in it.

      T 1 Reply Last reply
      0
      • P Pete OHanlon

        Don't be sorry about what your native language is. French is a beautiful language, and is one of the cornerstones of modern English. Rejoice in your native speech. Glory in it.

        T Offline
        T Offline
        techker2
        wrote on last edited by
        #9

        thx. im still stock on this... i think i got it. [code] StreamWriter log; if (!File.Exists("auth.txt")) { log = new StreamWriter("auth.txt"); } else { log = File.AppendText("auth.txt"); } log.WriteLine(DateTime.Now); log.WriteLine(lines); log.WriteLine(); textBox1Message.AppendText(lines); log.Close(); [/code]

        1 Reply Last reply
        0
        • T techker2

          hey guys 2 questions is there a way to make a login to read from file.txt?it is just a demo app..so no security for now. or can i read a file.txt and fill collectionbase??

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #10

          As we don't know what format your file is, I'm going to have to make some assumptions here. The first assumption is that the file is organised with one pin per line. Assuming this is true, then you can use File.ReadAllLines to read the files into an array - from there, if I were you, I'd probably load these records into a HashSet for speed of record retrieval. Here, I have to assume that you know what a HashSet is, and how to work with it. Finally, write a simple method that accepts a PIN, and looks in this HashSet to see if the file PIN is present.

          1 Reply Last reply
          0
          • T techker2

            sorry in C# just need to have user input a nip to enter main form.(nip stored in file auth.txt as for the load part i was thinking it would be easyer to search in a collection base the a file.so load file and insert info in collectionbase..

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

            Please tell me this is for a school assignment? Please tell me this is not a application that's going to be put into production? You really couldn't pick a more insecure method of storing passwords (pin's) if you tried.

            A guide to posting questions on CodeProject

            Click this: Asking questions is a skill. Seriously, do it.
            Dave Kreskowiak

            T 1 Reply Last reply
            0
            • D Dave Kreskowiak

              Please tell me this is for a school assignment? Please tell me this is not a application that's going to be put into production? You really couldn't pick a more insecure method of storing passwords (pin's) if you tried.

              A guide to posting questions on CodeProject

              Click this: Asking questions is a skill. Seriously, do it.
              Dave Kreskowiak

              T Offline
              T Offline
              techker2
              wrote on last edited by
              #12

              lol ya..i need to make an ATM machine...lol i got it going.thx

              D 1 Reply Last reply
              0
              • T techker2

                lol ya..i need to make an ATM machine...lol i got it going.thx

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

                I thought those requirements sounded familiar, but I had to check because there are those idiots who think this is a viable method of securing a production application in an enterprise environment. :) Kind of explains all the corporate credit card hacks, doesn't it...

                A guide to posting questions on CodeProject

                Click this: Asking questions is a skill. Seriously, do it.
                Dave Kreskowiak

                T 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  I thought those requirements sounded familiar, but I had to check because there are those idiots who think this is a viable method of securing a production application in an enterprise environment. :) Kind of explains all the corporate credit card hacks, doesn't it...

                  A guide to posting questions on CodeProject

                  Click this: Asking questions is a skill. Seriously, do it.
                  Dave Kreskowiak

                  T Offline
                  T Offline
                  techker2
                  wrote on last edited by
                  #14

                  lol.. now im stock on a simple numeric keypad. do i need to make it as a separate form?

                  D 1 Reply Last reply
                  0
                  • T techker2

                    lol.. now im stock on a simple numeric keypad. do i need to make it as a separate form?

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

                    It's "stuck", not "stock". You don't have to but it might be nice. I would probably do a numeric keypad as a custom control, but then again, I don't work on school projects any more.

                    A guide to posting questions on CodeProject

                    Click this: Asking questions is a skill. Seriously, do it.
                    Dave Kreskowiak

                    T 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      It's "stuck", not "stock". You don't have to but it might be nice. I would probably do a numeric keypad as a custom control, but then again, I don't work on school projects any more.

                      A guide to posting questions on CodeProject

                      Click this: Asking questions is a skill. Seriously, do it.
                      Dave Kreskowiak

                      T Offline
                      T Offline
                      techker2
                      wrote on last edited by
                      #16

                      Ha!lol ya looking it up.thx for the help

                      1 Reply Last reply
                      0
                      • T techker2

                        hey guys 2 questions is there a way to make a login to read from file.txt?it is just a demo app..so no security for now. or can i read a file.txt and fill collectionbase??

                        R Offline
                        R Offline
                        roya irani
                        wrote on last edited by
                        #17

                        public string connectionString = "Data Source=" + File.ReadAllText(Path.GetDirectoryName(Application.ExecutablePath) + "\\PCName.txt").ToString() + ";Integrated Security=SSPI;Initial Catalog=" + File.ReadAllText(Path.GetDirectoryName (Application.ExecutablePath) + "\\DBSName.txt"); use a this code in your Program,and make a notepad file in your one of the drive in your computer. just write your computer name in notpad the save it and close. :) if you don't have database, you don't write DBSName.txt in codesource.

                        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