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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:51:04+00:00 2026-06-12T20:51:04+00:00

I need to access user specific data in the controllers of an ASP.NET MVC

  • 0

I need to access user specific data in the controllers of an ASP.NET MVC 2 application. My controller class has 2 controller methods:

[ControllerSessionState(ControllerSessionState.ReadOnly)]
public class CalendarController : BasicController
{
    [Authorize]
    public ActionResult ControllerMethod1()
    {
       //reads session specific data
    }

    [Authorize]
    public ActionResult ControllerMethod1()
    {
       //stores session specific data
    }
}

I want the requests to be parallelized, that is, ControllerMethod1 should be able to run in parallel with ControllerMethod2. For this reason I marked the session as ReadOnly. However, ControllerMethod2 has to write data to the “session”. As this is not allowed, I think about storing my data in HttpContext.Application. I could encode the user-id in the name of the object, for example:

 HttpContext.Application["Data" + currentUser.UserId] = <<my_data>>;

Can I do it this way? Does this approach have any disadvantages?

  • 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-12T20:51:05+00:00Added an answer on June 12, 2026 at 8:51 pm

    Don’t specify ControllerSessionState.ReadOnly for a controller that obviously needs to write in the session store.

    Instead, try to address the concurrency issue another way (for example using an appropriate locking mechanism).

    Also, think about what are the odds that the same user accesses both methods at exactly the same time. I think these odds are so low that concurrency is not worth thinking about in this scenario.

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

Sidebar

Related Questions

I'm developing a ASP.NET MVC application with 3 layer classic architecture 1. data access
I have an ASP.NET website (in C#) that takes in user data and then
I'm writing an ASP.NET C# web site that needs to access data from a
I am creating an ASP.NET application that allows users to edit and insert data
I am writing an HTMLHelper but I need to access User.Identity.Name, how do I
I need to restrict user access to filebrowser using permissions. For example, only users
I need to access the commandline from within a C# application. I can't find
in my application I need to store settings that are 'global' (i.e. not user
I have a controller with several action methods requiring the same list of data
I am creating a website on ASP.Net in which a user logs on and

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.