Update SystemWebAdapters API from obsolete AddSystemWebAdapters to HttpApplicationHost.RegisterHost #36198
+34
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the ASP.NET Framework configuration examples to use the current
HttpApplicationHost.RegisterHost
API instead of the obsoleteSystemWebAdapterConfiguration.AddSystemWebAdapters(this)
method, which generates warning CS0618 in recent versions of the SystemWebAdapters library.Problem
The documentation was instructing users to use an obsolete API that causes the following compiler warning:
This affected users following the remote app setup guide for incremental ASP.NET Framework to ASP.NET Core migrations.
Changes
Updated all instances of the obsolete API pattern across documentation and sample code:
Before:
After:
Files Modified
aspnetcore/migration/fx-to-core/inc/remote-app-setup.md
- Updated manual setup instructions and metadataaspnetcore/migration/fx-to-core/areas/authentication/samples/AspNetApp.cs
- Updated authentication sampleaspnetcore/migration/fx-to-core/areas/session/samples/remote/Global.asax.cs
- Updated session sampleAll changes maintain consistency with the Aspire section pattern already present in the documentation.
Related Issue
Fixes #[issue number] - CS0618 warning about obsolete SystemWebAdapterConfiguration API
Original prompt
This section details on the original issue you should resolve
<issue_title>SystemWebAdapterConfiguration.AddSystemWebAdapters(HttpApplication)' is obsolete: 'Prefer using HttpApplicationHost.RegisterHost(...) instead</issue_title>
<issue_description>### Description
Hi Wade
Step 2 in Configure ASP.NET Framework Application is out of date. It generates a
warning CS0618: 'SystemWebAdapterConfiguration.AddSystemWebAdapters(HttpApplication)' is obsolete: 'Prefer using HttpApplicationHost.RegisterHost(...) instead'
I believe the code should be something like this:
Also, we are having trouble trying to get the recipe to work. We have adapted the https://github.com/dotnet/systemweb-adapters/tree/main sample to work using a domain setup (have set up two domains as framework.noho.ca and core.noho.ca) on our dev machines. We can log in to framework and then when we try to load the core app, it does not pick up the login details even though it does have the shared cookie. There are no errors and we are a bit fuzzy regarding the communication mechanism between the two.
Do you know of any example code which show the domain version using the manual setup? We got the Aspire version to run from the sample using the local host and the dashboard and could see login in the core app, and are trying to get a version running that we could apply to our main app. It is a very large project with a million lines of combined code.
Page URL
https://learn.microsoft.com/en-us/aspnet/core/migration/fx-to-core/inc/remote-app-setup?view=aspnetcore-9.0&pivots=manual
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/migration/fx-to-core/inc/remote-app-setup.md
Document ID
f3b2ce81-5438-1d1a-1c2b-6cc9a089a0ea
Platform Id
f8610778-e458-a8a6-8136-0ee8c72f11e8
Article author
@wadepickett
Metadata
Related Issues</issue_description>
Comments on the Issue (you are @copilot in this section)
@wadepickett Thanks for bringing this up @cas-matt! Greatly appreciated. We will fix it.Triage notes and draft action plan:
Issue Summary
This is a valid issue. The article "Remote app setup" instructs users to use
SystemWebAdapterConfiguration.AddSystemWebAdapters(this)
inGlobal.asax.cs
for ASP.NET Framework configuration. As of the latest SystemWebAdapters packages, this API is obsolete and emits CS0618, advising use ofHttpApplicationHost.RegisterHost(...)
instead. The article does not reflect this change and needs to be updated to prevent confusion and ensure best practices.Action Items
aspnetcore/migration/fx-to-core/inc/remote-app-setup.md
lines 59–73 and any other occurrences of the obsolete API.Details for Action Plan
Files Impacted
Configure ASP.NET Framework Application
Required Changes
1. Replace obsolete API usage
Current code (lines 62–73):
Replace with: