3

In my C# MVC view code I have a a hidden input field

<input type='hidden'  name='foo' value='${r.data}'/>

On my local machine when testing it generates the html source.

<input type='hidden'  name='foo' value='bah'/>

On my production server the source it sends to the client is

<input type="hidden"  name="foo" value="bah"/>

It has replaced the single quotes ' for double quotes ". which will break if there is a double quote in the variable data.

Now I know I should be testing for html special chars or at least doing

<input type="hidden"  name="buttons" value="${r.data.Replace(@"""", "&quot;")}"/> 

Why the difference between local machine and production output?

Where is this getting changed is it part of the spark view engine, or part of the Response builder in C# but that doesn't make sense? The only thing I can think of is a difference with IIS and the VS2010 inbuilt web server?

The file encoding is the same on local and production UTF8, there are using same dlls. and same build type being Release.

Both single and double quotes should be permitted. Single vs Double quotes (' vs ")

This doesn't make any sense how this could be happening And I feel like I am losing my mind.

Community
  • 1
  • 1
rqmedes
  • 540
  • 2
  • 14
  • the only thing I can think of is the doctype as it requires double not single quotes, but cannot see how the engine or web server would be translating the source going out – rqmedes Mar 07 '13 at 05:45

1 Answers1

1

A similar Question was Posted here ASP.NET MVC 2 and sparkviewengine rendering single quotes to double quotes in html5 data- attribute (with an accepted anwser) probably not the same MVC Version, but probally the same Bug.

Community
  • 1
  • 1
winner_joiner
  • 12,173
  • 4
  • 36
  • 61
  • Wow thanks nice find, explains why it works local as I am using 1.6 spark locally which has this bug fixed but only 1.5 is being used in production. Now need to find why me deploy is not syncing up dependencies. Thanks again ! – rqmedes Mar 07 '13 at 09:53