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 7809607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:29:39+00:00 2026-06-02T03:29:39+00:00

After checking a user’s credentials and confirming they are good, I’m using FormsAuthentication.SetAuthCookie(Username, false);

  • 0

After checking a user’s credentials and confirming they are good, I’m using FormsAuthentication.SetAuthCookie("Username", false); to authenticate the user.

In the masterpage I then use Page.User.Identity.IsAuthenticated to make sure we’re dealing with a logged in user and not a guest.

The problem lies in first setting the auth cookie. When I set the auth cookie, immediately afterwards I run a method that uses Page.User.Identity.IsAuthenticated to change the welcome message from a generic “Welcome, guest!” message to a more personal “Welcome, username!” message. This does not work until I go to another page, so I know the login process has worked, but it seems I cannot access the information I need until a refresh or a redirect happens.

Do I need to redirect the user after setting the auth cookie in order use Page.User.Identity.IsAuthenticated to change the message?

  • 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-02T03:29:41+00:00Added an answer on June 2, 2026 at 3:29 am

    I have seen this before so I know the answer is yes. (As in, yes you do need to redirect the user to correctly use Page.User.Identity.IsAuthenticated)

    What I imagine is the cause is because IsAuthenticated evaluates the current request, and when the current request first came in it was recorded as not authenticated.

    What you will need to do is apply whatever logic you have in said method without the check for IsAuthenicated (make it assume true).

    Now I don’t know the details of your method as to suggest how to re-factor it to cope with this, but you could split out the “Do Stuff” part into a separate function which you could then call directly from you login function to bypass the authentication check.


    EDIT: To back up my assumption you can read this page.

    The interesting part:

    The forms-authentication ticket supplies forms-authentication
    information to the next request made by the browser.

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

Sidebar

Related Questions

After checking out code for the first time from a repository into Eclipse using
After checking 20+ answers I'm sure there is no way to trace (using JS
How to remove using jquery html table row after checking checkbox that in this
I want to use _forward() in preDispatch after checking if the user is logged
I need to run some code prior to checking if a user's credentials are
After checking out a branch in a repository git always prints a list of
I have an array of uint-types in C#, After checking if the program is
how do i disable an html element after checking in php if it exists?
There is a lot of topics on Django concurrency, but after checking a lot
i created a login page in php and used session in it... after checking

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.