Validator console

0

Good evening, I need to program a user validator in C # (I own Visual studio). In the console style. I need a value of "id=" in the URL to be changed from a .txt list.

link idatualnalista & pc = 05

If you have such a message on the web page like "OK", then get the value of the current id and display a log in the console saying it is valid.

For example I added a list with three id's, two of which are invalid

2446
4452
4445

Because the last id of the list is valid, display the message in the console:

  

VALID 4445

Finally, save all "valid" ids in a .txt file in the same .exe directory.

Thank you!

I hope you have understood, I have no clue how to do this. If possible, please help me!

    
asked by anonymous 12.01.2018 / 07:37

1 answer

0

Your question is a little broad, but I'll put an example here for you how to read this file and pick up exactly the piece you need.

public void ReadFile()
{
    string line;
    using (StreamReader reader = new StreamReader(@"c:\temp\filelist.txt"))
    {
        line = reader.ReadLine();
        Console.WriteLine(line.Substring(line.IndexOf("id=", StringComparison.Ordinal), 7).Replace("id=", ""));
    }
    Console.ReadKey();
}

Then you will adapt it in your code and validate it .. this will return the piece of ID of your URL within the file.

    
12.01.2018 / 10:49