Reuse Connection with HttpWebRequest in C#

后端 未结 2 383
感动是毒
感动是毒 2021-01-15 00:47

I need to make a POST request using .Net.

I can authenticate by GET, and so I’m trying to make a POST request on the same connection to keep my authentication.

2条回答
  •  猫巷女王i
    2021-01-15 01:45

    The reason you don't stay logged in is because you don't give the HttpWebRequest a CookieContainer to keep the session id in.

    See the following to StackOverflow Q&A's for your possible solution:

    C# keep session id over httpwebrequest

    Multiple WebRequest in same session

    I hope this helped.

提交回复
热议问题