-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Update SystemWebAdapters API from obsolete AddSystemWebAdapters to HttpApplicationHost.RegisterHost #36198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Note: |
…Host Co-authored-by: wadepickett <[email protected]>
@copilot, verify if changes are required to match the new code in the topic that includes the code here: |
No changes are required. The authentication.md file is already consistent with the updated code from remote-app-setup.md. Verification details:
All documentation files that reference the remote app setup code are automatically pulling in the updated samples via the |
@twsouthwick, could use your review on this migration doc sample update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed and approved.
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: