Skip to main content
Home  › ... Razor

Basics: Linking and URL Parameters

Tutorial HomeLinking
#3 Linking with Modified Page Parameters
The samples can differ based on your Razor base class or if you're running an old version.
Switch to Typed (2sxc 16+) Switch to Dynamic (Razor14 or below)

Preserve URL Parameters and More

In Razor page URLs are generated using Link.To(...). By default calling Link.To() without any parameters returns the base URL of the site. In this case it would be: https://app-dev.2sxc.org/tutorial-razor/.

The key to retrieving the current page URL is to pass the current page parameters. Link.To(parameters: ...) will then construct the URL based on the passed parameters.
Current page parameters are found in CmsContext.Page.Parameters.

 

 

#3 Linking with Modified Page Parameters