Skip to content

Commit 7d71561

Browse files
Copilotwadepickett
andauthored
[Wait for GA] Update SystemWebAdapters API from obsolete AddSystemWebAdapters to HttpApplicationHost.RegisterHost (#36198)
* Initial plan * Update obsolete SystemWebAdapters API to HttpApplicationHost.RegisterHost Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
1 parent 31e0261 commit 7d71561

File tree

3 files changed

+34
-25
lines changed

3 files changed

+34
-25
lines changed

aspnetcore/migration/fx-to-core/areas/authentication/samples/AspNetApp.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ protected void Application_Start()
1414
BundleConfig.RegisterBundles(BundleTable.Bundles);
1515

1616
// <snippet_SystemWebAdapterConfiguration>
17-
SystemWebAdapterConfiguration.AddSystemWebAdapters(this)
18-
.AddProxySupport(options => options.UseForwardedHeaders = true)
19-
.AddRemoteAppServer(options =>
20-
{
21-
options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"];
22-
})
23-
.AddAuthenticationServer();
17+
HttpApplicationHost.RegisterHost(builder =>
18+
{
19+
builder.AddSystemWebAdapters()
20+
.AddProxySupport(options => options.UseForwardedHeaders = true)
21+
.AddRemoteAppServer(options =>
22+
{
23+
options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"];
24+
})
25+
.AddAuthenticationServer();
26+
});
2427
// </snippet_SystemWebAdapterConfiguration>
2528
}
2629
}

aspnetcore/migration/fx-to-core/areas/session/samples/remote/Global.asax.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ public class Global : HttpApplication
22
{
33
protected void Application_Start()
44
{
5-
SystemWebAdapterConfiguration.AddSystemWebAdapters(this)
6-
.AddJsonSessionSerializer(options =>
7-
{
8-
// Serialization/deserialization requires each session key to be registered to a type
9-
options.RegisterKey<int>("test-value");
10-
options.RegisterKey<SessionDemoModel>("SampleSessionItem");
11-
})
12-
// Provide a strong API key that will be used to authenticate the request on the remote app for querying the session
13-
// ApiKey is a string representing a GUID
14-
.AddRemoteAppServer(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"])
15-
.AddSessionServer();
5+
HttpApplicationHost.RegisterHost(builder =>
6+
{
7+
builder.AddSystemWebAdapters()
8+
.AddJsonSessionSerializer(options =>
9+
{
10+
// Serialization/deserialization requires each session key to be registered to a type
11+
options.RegisterKey<int>("test-value");
12+
options.RegisterKey<SessionDemoModel>("SampleSessionItem");
13+
})
14+
// Provide a strong API key that will be used to authenticate the request on the remote app for querying the session
15+
// ApiKey is a string representing a GUID
16+
.AddRemoteAppServer(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"])
17+
.AddSessionServer();
18+
});
1619
}
1720
}

aspnetcore/migration/fx-to-core/inc/remote-app-setup.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Remote app setup
44
author: wadepickett
55
ms.author: wpickett
66
monikerRange: '>= aspnetcore-6.0'
7-
ms.date: 09/16/2025
7+
ms.date: 10/08/2025
88
ms.topic: article
99
uid: migration/fx-to-core/inc/remote-app-setup
1010
zone_pivot_groups: migration-remote-app-setup
@@ -61,12 +61,15 @@ To configure the application to be available to handle the requests from the ASP
6161
```CSharp
6262
protected void Application_Start()
6363
{
64-
SystemWebAdapterConfiguration.AddSystemWebAdapters(this)
65-
.AddRemoteAppServer(options =>
66-
{
67-
// ApiKey is a string representing a GUID
68-
options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"];
69-
});
64+
HttpApplicationHost.RegisterHost(builder =>
65+
{
66+
builder.AddSystemWebAdapters()
67+
.AddRemoteAppServer(options =>
68+
{
69+
// ApiKey is a string representing a GUID
70+
options.ApiKey = System.Configuration.ConfigurationManager.AppSettings["RemoteAppApiKey"];
71+
});
72+
});
7073

7174
// ...existing code...
7275
}

0 commit comments

Comments
 (0)