Skip to content

System.Web.Razor

reference
1 min readUpdated

Kind: Service

Source: Pams/Core/Pams.Core/Pams.Core.csproj (line 1)

Part of: Pams

NuGet package dependency

System.Web.Razor is a NuGet package dependency declared by Pams.Core.csproj. It supplies Razor parsing and view-generation APIs for legacy ASP.NET components that compile or render Razor templates within the Pams.Core project.

Diagram

mermaid
sequenceDiagram
    participant Project as Pams.Core.csproj
    participant NuGet as NuGet Restore
    participant Razor as System.Web.Razor
    participant App as ASP.NET Component

    Project->>NuGet: Restore package dependency
    NuGet->>Razor: Resolve System.Web.Razor assembly
    Razor-->>App: Expose Razor parsing APIs
    App->>Razor: Compile or render Razor template

Usage

ts
// A browser client requests an ASP.NET endpoint whose response
// may be rendered by server-side Razor components.
async function loadRenderedView(path: string): Promise<string> {
  const response = await fetch(`/views/${encodeURIComponent(path)}`);

  if (!response.ok) {
    throw new Error(`View request failed: ${response.status}`);
  }

  return response.text();
}

loadRenderedView("dashboard")
  .then((html) => {
    document.querySelector("#content")!.innerHTML = html;
  })
  .catch((error) => {
    console.error(error);
  });

AI Coding Instructions

  • Keep the System.Web.Razor package reference compatible with the legacy project format used by Pams.Core.csproj.
  • Treat Razor rendering as server-side behavior; JavaScript clients should request rendered HTML through application endpoints.
  • Check target framework compatibility before changing the package version or replacing Razor-related dependencies.
  • Avoid mixing System.Web.Razor APIs with ASP.NET Core Razor APIs unless the project migration explicitly supports both.

Was this page helpful?

Download as PDF