anchor.diff:                  |> Res.RenderLink
           }
   
  +    // Store WebSharper user identity in the environment dictionary,
  +    // avoid overwriting principal set by OWIN authentication middleware
  +    let [<Literal>] WebSharperUserKey = "WebSharperUser"
  +
       type OwinCookieUserSession(ctx: IOwinContext) =
   
           let refresh (cookie: string) =
               match cookie with
  -            | null -> ctx.Authentication.User <- null
  +            | null -> ctx.Set(WebSharperUserKey, None)
               | cookie ->
                   let ticket = FormsAuthentication.Decrypt cookie
                   let principal = GenericPrincipal(FormsIdentity(ticket), [||])
  -                ctx.Authentication.User <- principal
  -
  -        do  // Using `try ... with` because `FormsAuthentication.Decrypt`
  -            // throws an exception when there is a cookie but its format is invalid
  -            try refresh ctx.Request.Cookies.[FormsAuthentication.FormsCookieName]
  -            with _ -> refresh null
  +                ctx.Set(WebSharperUserKey, Some principal)
  +            |> ignore 
  +
  +        let ensureUserHasBeenRefreshed () = 
  +            if ctx.Get(WebSharperUserKey) = null then 
  +                // Using `try ... with` because `FormsAuthentication.Decrypt`
  +                // throws an exception when there is a cookie but its format is invalid
  +                try refresh ctx.Request.Cookies.[FormsAuthentication.FormsCookieName]
  +                with _ -> refresh null
   
           interface IUserSession with
   
  
positive.code: 
              member this.GetLoggedInUser() =
                  async {
                      match ctx.Authentication.User with
                      | null -> return None
                      | x ->
                          if x.Identity.IsAuthenticated then
                              return Some x.Identity.Name
                          else return None
  
negative.code:                         { new Web.IContext with
                              member this.UserSession = session :> _
                              member this.RequestUri = uri
                              member this.RootFolder = webRoot
                              member this.Environment = upcast Map.ofList [(OwinContextKey, context :> obj)]}
                      let! body = reader.ReadToEndAsync() |> Async.AwaitTask
                      let! resp =
                          server.HandleRequest(
  