Table of Contents

Link.Base() / @Link.Base() Method in Dynamic Code

If you have a SPA on your page you will often need to set the proper base tag. To get it, use Link.Base().

Discover More in the Razor Tutorials

We have an rich series of Razor tutorials. You should really check them out 👍.


Use @Link.Base() for JavaScript SPA modules

Link.Base() ensures that the url can be used for SPAs, as some pages will otherwise provide a wrong link (like home) which then breaks the SPA.

<base href="@Link.Base()">

You should find some code examples in this demo App

History

  1. Link was Enhanced in 2sxc 9.5.1 with Base()