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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:12:51+00:00 2026-05-17T19:12:51+00:00

The title is a bit complicated, but it fits my problem. I have a

  • 0

The title is a bit complicated, but it fits my problem. I have a complex object that acts more like a service that I need to expose within the scope of a user’s session. The majority of the application will exist within a page or two and numerous ajax calls for dynamic interaction with the service. I’m still getting used to MVC so excuse the ignorance if the solution is easy. How do I expose an instance of the service per session to my controllers?

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-05-17T19:12:52+00:00Added an answer on May 17, 2026 at 7:12 pm

    Also see this SO question: How does the session state work in MVC 2.0?

    That answer contains a nice code sample such as the following about accesssing per-user session state from a controller class.

       // from example
       if (Session["QuestionAnswers"] != null)
       {
            return (List<QuestionAnswer>)Session["QuestionAnswers"];
       }
    

    You can use regular ASP.NET Session state to store a complex object for a particular user.

    You can store anything in session state, including your “complex object” value.

    MSDN Session State quote:

    ASP.NET session state enables you to
    store and retrieve values for a user
    as the user navigates the different
    ASP.NET pages that make up a Web
    application

    The following quotes from Scott Guthrie (a Corporate Vice President in the Microsoft Developer Division) support it use of regular session state in MVC:

    Scottgu Quotes about MVC & Session State support:

    Non-UI features in ASP.NET today like
    Forms Authentication, Windows
    Authentication, Membership, Roles, Url
    Authorization, Caching, Session State,
    Profiles, Health Monitoring,
    Configuration, Compilation,
    Localization, and
    HttpModules/HttpHandlers all fully
    support the MVC model
    .

    — http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx

    Although the way you structure
    application flow will be different, I
    think you’ll be pleasantly surprised
    by the amount of knowledge overlap
    that exists
    . Authentication,
    Authorization, Caching, Configuration,
    Compilation, Session State, Profile
    Management, Health Monitoring,
    Administration, Deployment, and many,
    many other things are exactly the
    same
    . MVC views are also .aspx pages
    (that use .ascx user controls and
    .master files). So the concept re-use
    is quite heavy there as well.

    — http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx

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

Sidebar

Related Questions

I have an HTML Document that looks a bit like this, only is far
Title might be a bit confusing, so let me explain. I have a website
If I have a table with a title column and 3 bit columns (f1,
Title more or less says it all. Specifically, I've become increasingly annoyed that in
My problem is a bit complicated: I am writing in c#, asp.net and using
I want to do THIS , just a little bit more complicated: Lets say,
I know the title's a bit wordy, but I don't know how else to
I think that the title accurately summarizes my question, but just to elaborate a
This question is a bit complicated, as there are alot of moving parts, but
So I know I butchered the title a bit but if someone looks here

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.