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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:04:37+00:00 2026-05-14T14:04:37+00:00

Why session is null in this even if i set: public class HelperClass {

  • 0

Why session is null in this even if i set:

public class HelperClass
{
    public AtuhenticatedUser f_IsAuthenticated(bool _bRedirect)
    {
        HttpContext.Current.Session["yk"] = DAO.context.GetById<AtuhenticatedUser>(1);
        if (HttpContext.Current.Session["yk"] == null)
        {
            if (_bRedirect)
            {
                HttpContext.Current.Response.Redirect(ConfigurationManager.AppSettings["loginPage"] + "?msg=You have to login.");
            }

            return null;
        }

        return (AtuhenticatedUser)HttpContext.Current.Session["yk"];
    }
}

alt text

  • 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-05-14T14:04:37+00:00Added an answer on May 14, 2026 at 2:04 pm

    Usually session is not available on application authenticate request.

    Session will be available after OnAcquireRequestState call.
    Here is application events call sequence

    Also, note that session will be available, only if target HttpHandler implements IRequiresSessionState or IReadOnlySessionState, and AuhenticateRequest is usually called for resources like .js or .jpg.

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

Sidebar

Related Questions

Here Scenario is HttpContext.Current.Session[value].ToString() gives null value, even have already set session value when
I'm getting a null pointer on line 15...below (Session session = HibernateUtil.getSessionFactory.getCurrentSession();) public static
I have two controller methods: public string Nothing() { if (Session[done] == null) {
tl;dr : In a legacy app, culture info is stored in HttpContext.Current.Session[culture] . How
I have a NHibernate repository that looks like this: public class NHibRepository : IDisposable
protected void LoginCheck() { if (Session["Login_Status"] == null || Session["Login_Status"] == "false") { MessageBoxShow("Please
I'm using the following Audio Session in my app delegate: AudioSessionInitialize(NULL, NULL, NULL, self);
The code fails at session.Save(employee); with AssertionFailure null identifier. What am I doing wrong?
I have below code behind in c# if (Session[cmpDictionaryTitle]!= null) { downloadLinks.Text += @<li><a
Collection.clear() will delete children whenever Session flushes. What about OneToOne? Setting to null is

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.