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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:46:33+00:00 2026-05-27T14:46:33+00:00

Well, I think the ASP.NET MVC team released a pretty significant bug in the

  • 0

Well, I think the ASP.NET MVC team released a pretty significant bug in the developer preview for asp.net mvc 4, or I’m doing something stupid… Here’s the issue and steps to reproduce.

  1. Create a new MVC 4 mobile application
  2. create a new section in the layout (ex. @RenderSection(“head”,false))
  3. in the controller action just throw a Message into the ViewBag
  4. then in a view that uses the main layout, add the following code below.
@section head {
    $(function() { 
        var newVariableName = "@(ViewBag.Message)";
    });
}

You’ll notice that the razor parser actually thinks that the section has been completed for the jquery on dom loaded ending brace instead of the section’s ending brace. I tried the exact same code in an asp.net MVC 3 application and it worked with no issues.

Has anyone else come across this bug in the ASP.NET MVC 4 Developer Preview?

  • 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-27T14:46:34+00:00Added an answer on May 27, 2026 at 2:46 pm

    A quick hack to solving this issue is to use < text > blocks < /text > around the java script. Here’s what it might look like until the ASP.NET MVC team resolves this bug.

    @{
    <text>
        $(function()
        {
            var newVariableName = "@(ViewBag.Message)";
        });
    </text>
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm actually using ASP.Net MVC, but I think this applicable to ASP.Net as well.
[Disclaimer: I'm ASP.NET MVC Developer] Hi, I'm looking for some best practices with implementing
I'm using NPOI to output excel from Asp.Net MVC app and works very well
I'm building an ASP.NET MVC 2 site that uses LINQ to SQL. In one
I'm working on a big ASP.NET MVC site, a commerce service sold to customers.
I just converted a my controller to asyncController in asp.net mvc 2. (ie: spliting
I'm in the process of developing an ASP.NET MVC project, and after several weeks
To start off, I'm using Asp.Net MVC 4, and I've modified my solution to
In my ASP.net mvc app I am using a Service Layer and Repositories to
I've got two questions about Asp.Net MVC areas. I have only a shallow understanding

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.