locked
If I want to use library 'using System.Net.Http;' but it can not use it in .net Framework 2.0 RRS feed

  • Question

  • I want to use library 'using system.Net.http;' in .net Framework 2.0

    reason is I want create function for authorized by use token because It is old system but still need to add new feature

    if It can not use these library 

    There is another way?

    for this solution.

    Tuesday, September 4, 2018 3:12 AM

All replies

  • You need to use something like System.Net.WebClient or System.Net.HttpWebRequest instead.
    Tuesday, September 4, 2018 3:42 AM
    Answerer
  • I must add reference ?

    what is name of there library of adding reference ? 

    Tuesday, September 4, 2018 3:55 AM
  • still not can use it.

    Tuesday, September 4, 2018 4:56 AM
  • Hi,

    Please try WebRequest , and here is a sample for your reference.

    https://support.microsoft.com/en-sg/help/307023/how-to-make-a-get-request-by-using-visual-c

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 4, 2018 5:13 AM
  • Just "using System.Net;"

    These are two classes we use in .NET v2 era to do HTTP/HTTPS based communications. You need to write code to make use of it.

    Tuesday, September 4, 2018 1:48 PM
    Answerer
  • You didn't mention what type(s) in System.Net.Http you wanted to use but I assume it is HttpClient. In that case use WebClient. It was the predecessor and works fine for sending/receiving the same kinds of requests in most cases.

    To use it just add a using statement to System.Net. Alternatively just new up an instance of WebClient. Then, if you're using VS 2017, click on it to get to the quick action options and they'll be an option to add the using statement automatically.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, September 4, 2018 1:50 PM