I have a project for school where I am to create some form of security for an application, our brief was to basically to create and hide a text file in the applications program files (not all that secure really, but heh I don't write the briefs)

So I have created the code and form to check that a users security key is valid it all works perfectly in the debugger, it writes the file to the specified directory, however when I run the application on a computer (after deploying it with the correct directories being set up, it never creates the .txt file to write the information created during "Authentication" - I am really confused and I am not sure if this is part of the "problem" I am supposed to be solving for school, or whether this is just some crazy exception that has been thrown up. Can anyone offer any advice?

Do you write it to a SPECIFIC directory or are you using "current directory"?

to a specific directory which is also determined by the OS version using this code

ElseIf My.Computer.Info.OSFullName.Contains("7") Then
Dim AuthFile7 As String = "C:\Program Files (x86)\New College Nottingham\Desktop Timer\Documentation\Auth.txt"
                Dim oFile As System.IO.File
                Dim oWrite As System.IO.StreamWriter
                oWrite = IO.File.CreateText(AuthFile7)
                oWrite.Close()
                Dim objWriter As New System.IO.StreamWriter(AuthFile7)
                For x = 0 To 3
                    objWriter.WriteLine(Auth(x))
                Next
                objWriter.Close()
                Dim authfilehide As IO.FileInfo = My.Computer.FileSystem.GetFileInfo(AuthFile7)
                authfilehide.Attributes = IO.FileAttributes.Hidden

I have also noticed that the application does not read the file (if I place it there manually) but does read the file in VS2010 debugger.

If My.Computer.Info.OSFullName.Contains("XP") And IO.File.Exists(AuthFileXP) = False Then


            authform.Show()
            Me.Close()

        ElseIf My.Computer.Info.OSFullName.Contains("Vista") And IO.File.Exists(AuthFileVISTA) = False Then

            authform.Show()
            Me.Close()

        ElseIf My.Computer.Info.OSFullName.Contains("7") And IO.File.Exists(AuthFile7) = False Then
Dim AuthFile71 As String = "C:\Program Files (x86)\New College Nottingham\Desktop Timer\Documentation\Auth.txt"
            authform.Show()
            Me.Close()


        End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.