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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:52:34+00:00 2026-06-14T19:52:34+00:00

I had this question I was looking for the answer and I saw this

  • 0

I had this question I was looking for the answer and I saw this question’s answer

What's the difference between ViewData and ViewBag?

which in the answer many people mentioned using neither ViewBag or ViewData is “safe”. I did not understand why since I’m new to web applications and the whole concept of it and also to MVC overall. So my questions are:

  1. Why is ViewBag and ViewData not a safe way to pass data?
  2. What is the best way to pass data? (The most important question)

I really appreciate your help!

  • 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-14T19:52:35+00:00Added an answer on June 14, 2026 at 7:52 pm

    The alternative is a strongly typed model object. Some people prefer this because it prevents some of the runtime exceptions that can occur when working with the dynamic ViewBag object. It also allows useful IDE features like autocompletion and tends to lead to more readable code.

    There is a good blog post from Microsoft’s Rick Anderson that describes and gives examples of the different options, which you may find useful.

    If the strongly typed option looks like something you’d like to pursue, this tutorial may be useful: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/accessing-your-models-data-from-a-controller

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

Sidebar

Related Questions

I found this question which had an answer to the question of performing batch
I was reading the answer to this question: Haskell: difference between . (dot) and
I always had this question: When i dont mind the exact floating number Which
This question has two parts. Part 1. Yesterday I had some code which would
( This question , though similar, didn't really answer my question.) I've had problems
(I had already written this question out when I figured out the answer, so
I have scoured the internet looking for an answer to this question and can't
I was looking at this question: How to implement multiplication without using multiplication operator
I had asked this question Adding more attributes to LINQ to SQL entity Now,
I know this question had been asked a hundred times, but I have difficulties

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.