Class PageBaseExtensions
- Namespace
- Cuemon.Extensions.AspNetCore.Mvc.RazorPages
- Assembly
- Cuemon.Extensions.AspNetCore.Mvc.RazorPages.dll
Extension methods for the PageBase class.
public static class PageBaseExtensions
- Inheritance
-
PageBaseExtensions
Examples
The following example demonstrates how to resolve application-base URLs and CDN URLs for static resources from a Razor Page model.
using Cuemon.Extensions.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace MyApp.Examples;
public class PageBaseExtensionsExample
{
public void Demonstrate(PageBase pageModel)
{
string appScript = pageModel.GetAppUrl("js/site.js");
string cdnImage = pageModel.GetCdnUrl("images/logo.png");
}
}
Methods
GetAppUrl(PageBase, string)
Gets the fully qualified URL for a static resource of your application.
public static string GetAppUrl(this PageBase pageModel, string src)
Parameters
Returns
- string
A concatenated string of the formatted base URL from AppTagHelperOptions and the specified
src.
GetCdnUrl(PageBase, string)
Gets the fully qualified URL for a static resource placed outside your application (typical CDN).
public static string GetCdnUrl(this PageBase pageModel, string src)
Parameters
Returns
- string
A concatenated string of the formatted base URL from CdnTagHelperOptions and the specified
src.