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

  • Home
  • SEARCH
  • 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 6887965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:57:00+00:00 2026-05-27T05:57:00+00:00

Passing small amount of data from one controller to another controller, do I use

  • 0

Passing small amount of data from one controller to another controller, do I use ViewBag? ViewData? or Session…etc… what is the right approach.

e.g. My First [Controller1]/[Action: Register] generates the userid and then needs to be redirected to another controller

return RedirectToAction(“Create”, “Controller2”);

Then on Create (HttpPost) I am storing the data + plus the userid to the database and then redirecting to the next controller which acts the same way on HttpPost it stores the data + plus the userid to the database.

I am a bit lost what approach should I take, how do I pass the userid in a secure way/right way?, please advice, Thank you

  • 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-27T05:57:00+00:00Added an answer on May 27, 2026 at 5:57 am

    If its not private, just pass it on the url using the third parameter in your redirect:
    new {id=whateverValue}

    If it is private data, use TempData – it will be removed after the next request reads it (well at the end of the request)

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

Sidebar

Related Questions

I've recently faced a problem involving passing data (small amount), from a page to
I'm working on a small silverlight application that involves passing some data between javascript
I'm passing small (2-10 KB)XML documents as input to a WCF service. now I've
passing post data using cURL requires that the name of the input. However, I
warning: passing argument 1 of 'bsearch' makes pointer from integer without a cast and
If I am passing an object to a method, why should I use the
Im using a large amount of very small web services in my app and
I have a small program to test passing char* pointers in and out of
I have a small Spring based application and one of my classes needs additional
I'm using php to build a small form that requires passing 2 variables for

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.