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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:46:29+00:00 2026-05-23T16:46:29+00:00

I need to have a global Binary (Linq.Binary) variable (user reference), available for all

  • 0

I need to have a global Binary (Linq.Binary) variable (user reference), available for all controllers, which is filled in the process of authorization. I decided to use TempData. (May be, there is more suitable way?). I dont need MVC Membership system, only one variable.

When I close website, and then enter it again, my TempData is empty, and I need to restart authorization for user again. How to do it?

  • [Authorize] did not work – user already authorized.
  • I tried to insert this code in critical controllers:

if
(!TempData.ContainsKey(“CustomerRef”))
FormsAuthentication.RedirectToLoginPage();

but nothing happens.

  • I tried to overload AuthoriseAttribute, but it looks impossible to look in TempData in AuthoriseAttribute class.
  • I can’t store this variable in cookies – it’s critical.
  • I dont want to store it somewhere in database.

The best way for me is to reset user authorisation some way, if TempData is empty, but I dont know, how to do it. Or, may be I’m re-inventing the wheel? 🙂

P.S.: I’m using TempData.Peek() while getting data, so variable didn’t flashes.

  • 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-23T16:46:30+00:00Added an answer on May 23, 2026 at 4:46 pm

    I’m trying to understand your question but it’s a little bit vague for me. So you wan’t to keep some extra critical user information when they are logged in?

    I had a similiar situation , what I did was:

    • Create a static class with a static Dictionary<String,someClassWithExtraValues>
    • During the authentication I would add a new value to the dictionary with as key the User.Identity.Name. That way I could always reach the values for the logged in users.
    • When the users logs out I delete his value.

    You could use it in cookies even if it’s critical, once the FormsAuthentication cookie is manually changed it becomes invalid. Ofc there is still cookie stealing etc.

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

Sidebar

Related Questions

I have a vector declared as a global variable that I need to be
I am developing a shared library(.so) and dll. I have a global variable which
I have a global object in my main controllers that I need to pass
i have a global variable who hold the value for routing i need to
I need a way to have a single static variable for all kinds of
VB 6.0 does not have any global handler.To catch runtime errors,we need to add
I have the following need I have a logging table which logs som leads
I have a global object X and a class A. I need a function
can I have a global dict in my code which is something like the
I'm new to building application on Mac. I have global data that I need

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.