Question: I'm trying to change the layout page based on a cookie so i tried doing this:

```
 function LoggedOrNot()
    {
        @if (Page.User.Identity.IsAuthenticated)
        {
            var x = document.cookie;
            document.getElementByID("signupbutton").innerHTML = x;
        }
    }

```

but it's not recognizing `document`

Answer: 
That's because Razor thinks you're still writing C# code. Use `<text>` to tag it as plain text:

```
function LoggedOrNot()
{
    @if (Page.User.Identity.IsAuthenticated)
    {
        <text>var x = document.cookie;
        document.getElementByID("signupbutton").innerHTML = x;</text>
    }
}

```
You should wrap it in text tags.

```
<text>var x = document.cookie; document.getElementByID("signupbutton").innerHTML = x</text>

```

This is because here you define a block of razor code and the ViewEngine, when try to execute the View see this like a c# command. Apparently, in this context there isn't any variable called document. Furthermore, you need there to embed some js code. The way to do so, is to wrap it into text tags.

```
@if (Page.User.Identity.IsAuthenticated)
{
    <text>var x = document.cookie; 
    document.getElementByID("signupbutton").innerHTML = x</text>
}

```