locked
HttpWebRequest and WebResponse in .NET 2.0 RRS feed

  • Question

  • Will HttpWebRequest and WebResponse work in .NET framework 2.0?
    If yes, then what are the alternatives?
    Thursday, February 5, 2015 5:34 AM

Answers

  • Yes, it will work all the way to .NET Framework 4.5.

    https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx

    chanmm


    chanmm

    • Proposed as answer by chanmmMVP Thursday, February 5, 2015 6:46 AM
    • Marked as answer by Kristin Xie Sunday, February 15, 2015 9:41 AM
    Thursday, February 5, 2015 6:46 AM
  • Yes,

    Please also check HttpWebRequest Class and WebRequest Class in MSDN documents located other Versions section.

    Both of them support in .NET framework 2.0.

    Here is a sample code to help you understand more details.

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        HttpWebResponse response = (HttpWebResponse) request.GetResponse();
        Stream s = response.GetResponseStream();
        using (StreamReader sr = new StreamReader(s))
        {
            s.Flush();
            resultString = sr.ReadToEnd();
    
            ...
        }
    public class HttpWebRequest : WebRequest, ISerializable

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Kristin Xie Sunday, February 15, 2015 9:41 AM
    Wednesday, February 11, 2015 5:25 AM

All replies

  • Yes, it will work all the way to .NET Framework 4.5.

    https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx

    chanmm


    chanmm

    • Proposed as answer by chanmmMVP Thursday, February 5, 2015 6:46 AM
    • Marked as answer by Kristin Xie Sunday, February 15, 2015 9:41 AM
    Thursday, February 5, 2015 6:46 AM
  • your question about web application not about c#, move your problem to asp.net forum
    Thursday, February 5, 2015 8:27 AM
  • Yes,

    Please also check HttpWebRequest Class and WebRequest Class in MSDN documents located other Versions section.

    Both of them support in .NET framework 2.0.

    Here is a sample code to help you understand more details.

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        HttpWebResponse response = (HttpWebResponse) request.GetResponse();
        Stream s = response.GetResponseStream();
        using (StreamReader sr = new StreamReader(s))
        {
            s.Flush();
            resultString = sr.ReadToEnd();
    
            ...
        }
    public class HttpWebRequest : WebRequest, ISerializable

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Kristin Xie Sunday, February 15, 2015 9:41 AM
    Wednesday, February 11, 2015 5:25 AM