アプリケーションに登録されているユーザーのフルネームと、サードパーティ認証を介してログインした場合のユーザー名を表示するための、ビュー内の私のヘルパー。
@using MyApp.Models;
@helper GetUserName()
{
    if (User.Identity.AuthenticationType == "Application")
    {
        using (var db = new MyAppDbContext())
        {
            @db.Users.Find(User.Identity.GetUserId()).FullName
        }
    }
    else
    {
        @User.Identity.GetUserName()
    }
}
次に、このヘルパーを使用します。
@if (Request.IsAuthenticated)
{
    using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-form pull-right" }))
    {
    @Html.AntiForgeryToken()
    <ul class="nav">
        <li>
            @Html.ActionLink("Hello " + GetUserName() + "!", "Manage", "Account", routeValues: null, htmlAttributes: new { title = "Manage" })
        </li>
        <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>
    </ul>
    }
}
私のユーザーの名前は Proba234 で、次のように表示されます。

奇妙な文字 ( ) が表示される理由と<$G+$>、それらを取り除く方法を教えてください。