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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:35:54+00:00 2026-06-16T04:35:54+00:00

Im using a session variable to pass the user ID from the Index to

  • 0

Im using a session variable to pass the user ID from the Index to the Create in the HomeController. ATM the user can use a drop down to select their name from the list of users and click View to list the holidays they have previously booked. From there the user can click create which will bring the user to a page which enables them to create a new holiday. From here they have to select their name again from the drop down list.

I want to store the users ID from the previous drop down so it will update automatically if they try to create another holiday (to replace the second drop down)

Im using a session variable to do this, iv put

Session["userameID"] = currentID;

in my view. Iv break pointed it just after and if I hold my mouse over currentID it displays the correct ID of the user.

So iv tried to pass this down to the create method using

string xx = (string)Session["usernameID"];

However, string ‘xx’ is returning NULL (tested with breakpoint)

I then placed the entire session in the view

Session["userameID"] = HolidayDate;

string xx = (string)Session["usernameID"];

and string xx is still returning null.

Is it not meant to return the userID???

Thanks for any replys

  • 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-16T04:35:55+00:00Added an answer on June 16, 2026 at 4:35 am

    Two posible causes of your problem:

    1. You are not using the same name for the session variable when you assign it and retrive it (userameID -> usernameID)

    2. The type you assign is not a string, when you retrieve the value it can not be casted (assumed you solved issue 1)

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

Sidebar

Related Questions

I am using a Session variable to pass a datatable from 1 page to
I am trying to pass a session variable from the log in script to
New to SPA MVC4, trying to pass a session variable to LinqToEntitiesDataController from the
We are using Sharepoint 2007 We initialising the session variable on page load We
I have login page, once logged in I create a session variable to store
Is it good way to pass variable between pages using $_GET method with url:
I using Openjdk 7 and JBoss 7. I can use sessions with cookies good.
I'm creating a shopping basket in ASP.NET using session variables to pass the data
I am trying to update/create session variable when I change the option thru a
As the title says, is there another way to pass a variable from "current"

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.