Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8971401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:56:42+00:00 2026-06-15T17:56:42+00:00

I built a site using the starter site template in Webmatrix that uses a

  • 0

I built a site using the starter site template in Webmatrix that uses a log in. After a user logs in, it displays near the top “Hello, (email address)!”

Looking at the html code, I see

Hello, <a id="logname" class="email" href="~/Account/Manage" title="Manage">@WebSecurity.CurrentUserName</a>!

I’m just a beginner with asp.net but can work things out following logic, so what I have done is added a ‘Name’ field to the database where the email and password is stored and edited the registration page so users can enter their name as well, it writes to the database no problems.

Now I assumed it’s just a matter of finding where @WebSecurity.CurrentUserName is referring to the user’s email address and make it point to the Name field instead. However I’ve searched high and low and can not seem to find it anywhere.

So my next approach was to use code from a Bakery database tutorial that fetches data from a field and modify it to grab the name and display it where I want, the code I tried to use here:

@foreach(var row in db.Query(selectQueryString))

This appeared to work at first, It displayed “Hello, Ben!” but then if I made any more accounts it started to display them too, so after a while I was getting “Hello, Ben, Steve, Grace, etc…”

Even though I’m a beginner I do realize that this code isn’t quite what I need, but something similar that takes that single Name field but only from the currently logged in user… I’ve googled and searched and seen many people wanting the same thing, except it’s using PHP or VB or something that isn’t Webmatrix.

If it’s a quick answer I’d appreciate the code I need, or otherwise pointed in the right direction, any help would be greatly appreciated. Thanks in advance..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:56:43+00:00Added an answer on June 15, 2026 at 5:56 pm

    OK ironically I find the solution moments after posting the question, so here goes..

    This is the code needed to be put at the very top of the file _SiteLayout.chtml

    @{
    var authenticatedUser = "";
    
    if (WebSecurity.IsAuthenticated) {
    authenticatedUser = WebSecurity.CurrentUserName;
    var db = Database.Open("StarterSite");
    var UserData = db.QuerySingle("SELECT Name FROM UserProfile WHERE LOWER(Email) = LOWER(@0)", authenticatedUser);
    authenticatedUser = UserData.Name;
        }
    }
    

    StarterSite is the name of the database, and UserProfile is the name of the Table, and I labeled the name field Name (explained for the purpose of beginners like me who might be reading this)

    Then in the html markup I changed @WebSecurity.CurrentUserName to @authenticatedUser so now it reads:

    Hello, <a id="logname" class="email" href="~/Account/Manage" title="Manage">@authenticatedUser</a>!
    

    resulting in the desired outcome of it now displaying the user’s name instead of their email address.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a WebForms site built using Progressive Enhancement which uses Master pages. Obviously,
I have a web site built using ASP.NET MVC4 that I can publish fine
I have built a site using php and want to try keep it one
I have a client who has built her entire site using html extensions. As
I have more than 3000 members on a site built using wordpress. I am
I built a custom forum for my site using MySQL. The listing page is
I've built a site in MVC3 using EF 4.0 using the Repository pattern. Everything
I built a small cms for personal websites using Rails. Each site has a
Goal : Our application is built using multiple types (e.g. Person, PersonSite(ICollection), Site -
I've built a mobile site using a CSS sprite for some of the icons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.