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

  • SEARCH
  • Home
  • 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 8837555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:45:22+00:00 2026-06-14T09:45:22+00:00

When users log in, their sessions are set like so: HttpContext.Current.Session[LoggedIn] = true; HttpContext.Current.Session[FullName]

  • 0

When users log in, their sessions are set like so:

HttpContext.Current.Session["LoggedIn"] = true;
HttpContext.Current.Session["FullName"] = (string)Reader["FirstName"] + " " + (string)Reader["LastName"];

My Site.master file contains a navigation menu that’s site-wide, and I’d like to change it to show different links depending on if the user is logged in or not.

Something like this in Site.master:

<div id="navigation">
    <ul>
    <% 
        if (HttpContext.Current.Session["LoggedIn"] != null)
        {
            %><li><a href="/user74/aspnet/Logout.aspx">Log out</a></li><%
        }
        else
        {
            %>
                <li><a href="/user74/aspnet/Register.aspx">Register</a></li>
                <li><a href="/user74/aspnet/Login.aspx">Log in</a></li>
            <%
        }
    %>
    </ul>
</div>

However, this doesn’t seem to work. Looks like you can’t use ASP tags like PHP tags.

How can I achieve this?

  • 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-14T09:45:24+00:00Added an answer on June 14, 2026 at 9:45 am

    Seems like you are more in to PHP,For starters I recommend you go for the normal .NET process

    1.Write HTML in aspx page,replace HTML ‘a’ with asp:linkbutton ,likr

    <div id="navigation">
     <ul>
      <li><asp:LinkButton ID="LinkButton2" runat="server" PostBackUrl="/user74/aspnet/Logout.aspx">Log out</asp:LinkButton></li>
     </ul>
    </div>
    

    2.Write codes in pagename.aspx.cs page,in your case write session checks in page_load event

    protected void Page_Load(object sender, EventArgs e)
    {
        if (HttpContext.Current.Session["LoggedIn"] != null)
        {
            LinkButton1.Visible = true;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to log when a user ends their session on
As in many web applications, when my users log into my site, I set
When my users log into the website their first name, last name and ID
How to redirect the users to their id specific urls/landing pages after they log
I want in my wordpress website that user can log in through their facebook
A client uses classic ASP to log in to their web based backoffice. I
I have a WPF form that uses ClientLogin to log a user into their
Is there any way I can log a Wordpress user in given only their
Our users log into the production database as a fairly low-level user, with SELECT
I am building a publicly facing website that does the following. Users log in.

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.