Skip to content

Conversation

@lorieide
Copy link
Contributor

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

@lorieide lorieide requested review from a team as code owners June 12, 2024 14:50
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 12, 2024
@ghost ghost added the area-System.Net label Jun 12, 2024
@learn-build-service-prod

This comment was marked as outdated.

@gewarren
Copy link
Contributor

@lorieide What's the motivation behind this PR?

@lorieide
Copy link
Contributor Author

@lorieide What's the motivation behind this PR?

@gewarren Sure. I've been assigned this GitHub issue to resolve https://github.com/MicrosoftDocs/azure-docs/issues/111552

@lorieide
Copy link
Contributor Author

lorieide commented Jun 12, 2024

@gewarren Here's what I found:
The .NET WebRequest and HttpWebRequest classes are indeed considered obsolete and are recommended to be replaced with HttpClient. This is in line with modern development practices and the evolution of the .NET framework. Specifically, as per the Microsoft documentation, starting from .NET 5+, it is advised to use HttpClient instead of WebRequest, HttpWebRequest, ServicePoint, and WebClient.
I validated this information is correct as all of these topics have a scattered Important note about this development.
I recommend adding a warning note as an include below to all of the topics in the WebRequest, ServicePoint, WebClient, and HttpWebRequest Class topics.

@learn-build-service-prod

This comment was marked as outdated.

@gewarren
Copy link
Contributor

@lorieide Ahh, okay. Currently, if a .NET API is marked with the ObsoleteAttribute, for example, WebRequest.Create, then the API reference docs automatically show the CAUTION block with the text from the ObsoleteAttribute. So that's why you see the info on some APIs and not others. There's also a work item to propagate the obsolete warning to all members of a type that's marked obsolete (although I don't think that applies to any of these 4 System.Net types unfortunately).

Related to #6867.

@learn-build-service-prod

This comment was marked as outdated.

@learn-build-service-prod

This comment was marked as outdated.

@learn-build-service-prod

This comment was marked as outdated.

@learn-build-service-prod
Copy link

Learn Build status updates of commit 409844e:

✅ Validation status: passed

File Status Preview URL Details
includes/web-request-obsolete.md ✅Succeeded View
xml/System.Net/HttpWebRequest.xml ✅Succeeded View
xml/System.Net/ServicePoint.xml ✅Succeeded View
xml/System.Net/WebClient.xml ✅Succeeded View
xml/System.Net/WebRequest.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@MihaZupan
Copy link
Member

FYI ServicePointManager was just marked as obsolete in dotnet/runtime#103456.
And while types like ServicePoint/WebRequest aren't explicitly marked as obsolete, they effectively are since all the ways to obtain their instances (ServicePointManager.FindServicePoint, WebRequest.Create) are obsolete.

@learn-build-service-prod
Copy link

Learn Build status updates of commit f9a8675:

✅ Validation status: passed

File Status Preview URL Details
includes/web-request-obsolete.md ✅Succeeded View
xml/System.Net/HttpWebRequest.xml ✅Succeeded View
xml/System.Net/ServicePoint.xml ✅Succeeded View
xml/System.Net/WebClient.xml ✅Succeeded View
xml/System.Net/WebRequest.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@gewarren gewarren merged commit 523b75c into dotnet:main Jun 18, 2024
@lorieide lorieide deleted the leide-web-request-obsolete branch June 19, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants