Domanda

I have a razor view in an MVC4 project that treats the same input differently in two different environments. I have a script block within an MVC section.

At my live deployment, whenever I create a less than comparison (if(a < b)), the < will be interpreted as a HTML block, and the section will render in a weird manner. Currently, I have to use Html.Raw("<"). At my development machine, I do not have this issue.

I'm sure there's a simple answer to why razor doesn't realize that the < is part of my javascript, but right now, I'm only interested in why the behavior would be different across delpoyments. I know both setups are running razor v2, since new features like conditional attributes are working in both.

What could be the cause of discrepancies such as this?

È stato utile?

Soluzione

Check the file version of System.Web.Razor.dll in both environments and see whether it's 2.0.20715 in both places. We did release an update to Razor v2 that's included in the MVC 4 installer via Web PI, but isn't in the box in Visual Studio 2012, which might account for the difference in behavior that you're seeing.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top