Console validator

Asked

Viewed 42 times

0

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

https://www.sitevalidador.com.br/bi5/Paginas/cliente/Login.aspx?id=idatualnalista&pc=05

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

For example I added a list with three id’s being two of them invalid

2446
4452
4445

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

VALID 4445

And finally, save all "valid" ids to a . txt in the same directory of . exe.

Thank you very much!

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

  • you want to make a bot that enters a page by providing a url with the user id and pick up the answer to say whether it is valid or not, that’s it?

1 answer

0

Your question is a little wide, but I’ll put an example here for you of how to read this file and get 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 adapt it to your code and do its validations.. this will return the piece of your URL ID inside the file.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.