0

So I already asked something like this but the question was bland and pointless so I'll ask in more detail:

So I am currently trying to login to a website with my c# application. I've already analyzed Chrome's Network Debug tools and I've seen that it obviously uses HTTP POST. Now what I want to do is, login to the website via my app, and then access data that is only display if I logged in. Thing is, I am not sure how to pass on my information and get a cookie/authentication token in return which I could use to access other data. Would anyone be able to give me a hint or something like it?

Jan
  • 45
  • 7
  • https://learn.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest?view=netcore-3.1 – John Aug 09 '20 at 14:36
  • 2
    What have you tried so far? – Julia Aug 09 '20 at 14:36
  • Yes you are able to connect to a website if that website supports external applications connections. If it does, than most likely there is API in place. But without knowing more, it is hard to answer this question. If there is API in place, than usualy there is documentation that explains in more detail on "How to connect". – Bodul Aug 09 '20 at 14:42
  • @John I saw that but for some reason the Microsoft Documentations don't help me. They just confuse me. – Jan Aug 09 '20 at 15:00
  • @Julia Well I haven't done much yet since I gotta figure out the HTTP POST things. That mentioned, is it possible to retrieve data with POST in return of giving the data it needs? – Jan Aug 09 '20 at 15:00
  • @Bodul There is API but no documentation since it wasn't directly meant for stuff like that I guess. But it passes data around via APIs – Jan Aug 09 '20 at 15:01
  • @Jan you can read the response text from a POST request – John Aug 09 '20 at 15:02
  • @John are there any specific ways, or do I just have to mention something along the lines of "response text" in the code? I don't know how to call it yet but I'll be taking a look into it. – Jan Aug 09 '20 at 15:11
  • For web client you can use DownloadString(), for the other try https://pastebin.com/vYEcFAcW – John Aug 09 '20 at 15:15
  • @John I am not too familiar with this but I will try. Thank you. – Jan Aug 09 '20 at 15:21
  • Here's some [example](https://stackoverflow.com/a/62681494/12888024). Why almost everybody suggests ancient `HttpWebRequest` that is [not recommended](https://learn.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest?view=netframework-4.8#remarks) by Microsoft for the new development? – aepot Aug 09 '20 at 15:33

0 Answers0