ScriptManagerProxy¶
The ScriptManagerProxy component is a migration compatibility stub that renders no output. In Web Forms, ScriptManagerProxy was used in content pages and user controls to add scripts and services when the main ScriptManager was defined in a master page. In Blazor, this concept does not apply — ScriptManagerProxy exists solely to prevent compilation errors during migration.
Original Microsoft documentation: https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.scriptmanagerproxy?view=netframework-4.8
Migration Stub Only
This component renders nothing to the page. It exists so that migrated Web Forms markup compiles without errors. Once your migration is stable, remove <ScriptManagerProxy /> from your pages.
Features Supported in Blazor¶
No features are actively supported. The component silently accepts its presence in markup for migration compatibility.
Blazor Notes¶
- ScriptManagerProxy is a no-op component — it renders no HTML and performs no actions
- In Web Forms, this was needed because only one ScriptManager could exist per page, and content pages used ScriptManagerProxy to register additional scripts. In Blazor, there is no such restriction — use
IJSRuntimeanywhere.
Web Forms Features NOT Supported¶
- Script registration (
Scriptscollection) — Use Blazor'sIJSRuntime - Service references (
Servicescollection) — Use dependency injection andHttpClient - AuthenticationService, ProfileService, RoleService — Use ASP.NET Core Identity
Web Forms Declarative Syntax¶
<asp:ScriptManagerProxy
ID="string"
OnDataBinding="DataBinding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnUnload="Unload event handler"
runat="server"
Visible="True|False"
>
<Scripts>
<asp:ScriptReference Path="~/Scripts/custom.js" />
</Scripts>
<Services>
<asp:ServiceReference Path="~/WebServices/MyService.asmx" />
</Services>
</asp:ScriptManagerProxy>
Blazor Razor Syntax¶
HTML Output¶
ScriptManagerProxy renders no HTML output. It is a silent stub.
Migration Notes¶
When migrating from Web Forms to Blazor:
- Keep ScriptManagerProxy initially — Include
<ScriptManagerProxy />so your migrated content pages compile - Remove when stable — Delete
<ScriptManagerProxy />during your cleanup pass - Migrate script references — Replace
<Scripts>collections with Blazor'sIJSRuntime.InvokeAsyncor<script>tags in your host page - Migrate service references — Replace
<Services>collections with dependency-injected services
Best Practice
ScriptManagerProxy was a workaround for Web Forms' single-ScriptManager-per-page limitation. Blazor has no such limitation — you can call IJSRuntime from any component. Remove ScriptManagerProxy as soon as your page compiles without it.
Before (Web Forms — Content Page)¶
<%@ Page Title="Dashboard" MasterPageFile="~/Site.Master" %>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/Scripts/dashboard.js" />
</Scripts>
</asp:ScriptManagerProxy>
<asp:Label ID="lblStatus" runat="server" Text="Loading..." />
</asp:Content>
After (Blazor)¶
@inject IJSRuntime JS
@* ScriptManagerProxy included for migration, can be removed *@
<ScriptManagerProxy />
<Label Text="@status" />
@code {
private string status = "Loading...";
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await JS.InvokeVoidAsync("dashboardInit");
}
}
}
See Also¶
- ScriptManager - Page-level script management stub (migration compatibility)
- UpdatePanel - Partial rendering wrapper (migration compatibility)
- JavaScript Setup - Blazor JavaScript interop guidance
- Migration — Getting Started