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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:09:08+00:00 2026-06-14T07:09:08+00:00

i am working/tweaking the default install of asp.net mvc 4 .. added some views

  • 0

i am working/tweaking the default install of asp.net mvc 4 .. added some views ..

and when i try to pass a model to my view, that model (name and namespace) gets written out to page.

@Model Blah.Web.UI.Models.DirectoryModel
@{
    ViewBag.Title = "Directory";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

when i view my page, i see

Blah.Web.UI.Models.DirectoryModel Blah.Web.UI.Models.DirectoryModel

written out twice at the top of the page..

my controller just initializes the model and passes it inside the view..

also i noticed that this happens within @RenderBody() called form _layout.. so i am assuming it is done somewhere in my view..

even if i comment out all code on my view (accept the declaration above) i still see this string written out.

  • 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-14T07:09:09+00:00Added an answer on June 14, 2026 at 7:09 am

    Change

    @Model Blah.Web.UI.Models.DirectoryModel
    

    to

    @model Blah.Web.UI.Models.DirectoryModel
    

    The @model directive with lower case m tells razor what is the type of the model.

    On the other hand @Model with upper case M just calls ToString on the view’s Model property and writes the string in the response.

    That is why

     @Model Blah.Web.UI.Models.DirectoryModel
    

    Ouptuts: Blah.Web.UI.Models.DirectoryModel Blah.Web.UI.Models.DirectoryModel

    First it writes the the ToString of the Model and the rest of the line Blah.Web.UI.Models.DirectoryModel as plain text.

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

Sidebar

Related Questions

I am working on an ASP.Net web application that must print dynamically created labels
I'm tweaking a gallery plugin for a site that I'm working on, so that
Working with an undisclosed API, I found a function that can set the number
Working with H2 I get this error when I try to write a row
Working on the problems on Project Euler to try to learn Clojure. I'm on
Working on game where plates will be falling from top to bottom. Some plates
I am working on making all of our JS code pass through jslint, sometimes
The company that I'm working is working with SVN but I would like to
I'm working on a fairly standard Django app and lately I've been tweaking the
In my cakephp app I have an Option model. In my option/index view I

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.