---
updatedAt: 2025-06-16T23:14:25.000Z
agentTools:
  projectIndex: https://developers.directscale.com/llms.txt
---

# Razor Syntax Integration

Razor is a view engine supported in ASP.NET Model View Controller that allows you to mix HTML with server-side code using C#. DirectScale has integrated this syntax into the **Custom Content Editor** to [create custom pages](https://developers.directscale.com/docs/custom-pages) and [widgets](https://developers.directscale.com/docs/custom-widgets) for the **Web Office** and **eCommerce Shop**.

# Methods

You can use the following methods:

* `User` - Inject user data
* `GetSsoURL` - Allow for SSO linking
* `String` - You can add a translatable string

***

***

# How to Use

In a **Custom Content Editor**, such as [creating custom pages in **Web Office**](https://developers.directscale.com/docs/custom-pages), precede Razor syntax with an `@` sign.

***

***

In **Web Office Admin**, navigate to: **Code Customization** > **Custom Office Pages** > Click **+ ADD PAGE**.

![Custom Content Editor](https://lxteam.blob.core.windows.net/images/Resources/customizable%20web%20content/custom%20content%20editor.png)

***

## Type-Ahead

Once you type your `@` sign, the type-ahead feature will display the methods you can select:

![Use your mouse cursor, press ENTER, or TAB to select from method menu](https://lxteam.blob.core.windows.net/images/Resources/customizable%20web%20content/type-ahead-1.png)

If you select the **User** method, a second menu will display a complete list of [data point categories](https://help.directscale.com/hc/en-us/articles/360050456073) to select.

![Data Point categories menu](https://lxteam.blob.core.windows.net/images/Resources/customizable%20web%20content/type-ahead-2.png)

***

***

# User Method

Inject user data into the page. With this method, you can access any data you have on a user.

```html
// Output: Welcome Sam Space from UT!

<p>Welcome @User.AssociateName from @User.AssociateAddressState!</p>
```

***

## Data Point Categories

> 📘See a complete list
>
> [Data Point Categories](https://directscaledev.readme.io/docs/get-associate-data-points-gadp)

***

## Logic-Determined Markup

All valid Razor markup will compile in an HTML widget. This includes conditionals and loops. To display a line of markup depending on the user’s rank, you might use a line like this:

For example:

```html
@if(User.Rank == "Gold") { <p>You are a distributor. Your next rank isn't far away!</p> }
```

```html
//
// Output: IsCurrentUser returns true if the 
// logged-in user is viewing their own data.
//

@if (User.IsCurrentUser) { <div>Some Html</div> }
```

```html
//
// Output: DownlineLevel(treeName) for the logged-in user’s specified tree 
// (Enrollment, Placement, or Matrix) returns the downline level of the 
// user whose data is being viewed. If the user is not in the 
// logged-in user’s tree then it returns null.
//

@if (User.DownlineLevel("Placement")
```

***

***

# GetSsoURL Method

You can use DirectScale’s standard outbound [**SSO**](https://directscaledev.readme.io/docs/inbound-and-outbound-single-sign-on-sso).

To convert a URL to redirect through the DirectScale standard outbound SSO handler, use the Razor method’s `GetSsoUrl` method. This method accepts the redirect URL as an argument.

```html
<a href='@GetSsoUrl("http://mysite.com?token={DirectScale:Token}")'>Click to go to mysite</a> 
```

A URL will generate to DirectScale’s redirect handler, which will replace `{DirectScale:Token}` with a temporary SSO token and redirect to the given URL.

***

***

# String Method

You can add a translatable string by using the **String** method. This method accepts the String as an argument.

```html
<p>@String("Welcome!")</p>
```

This string will then be available for translation.

***

1. Click the **TRANSLATIONS** tab to add translations.
2. Click the ![Manage Translations](https://lxteam.blob.core.windows.net/images/Resources/customizable%20web%20content/symbol.png) symbol to open the **Manage Translations** module.

   ![Manage Translations symbol](https://lxteam.blob.core.windows.net/images/Resources/customizable%20web%20content/manage-translations.png)

   ![Manage Translations module](https://lxteam.blob.core.windows.net/images/Resources/customizable%20web%20content/manage-translations-2.png)

> 📘Read more in the Help Center
>
> [Managing Translations in Web Office Admin](https://help.directscale.com/hc/en-us/articles/360043942513)