Yes.. I am using uSiteBuilder and thought it might have something to do with the macro being in a uSiteBuilder template but tried with a clean template created in the backend an have the same issue..
I'm not aware of any config setting for this, but perhaps if you could performa diff of web.config and /config/umbracoSettings.config between your site and a clean download?
Well finally got it and it was my fault. It seems I was using a wrong version of the System.Web.WebPages.
Umbraco 4.9 comes with one along with other MVC dlls, which I referenced in the project BUT forgot to set the Copy Local to true for this dll and some others.
So the first time I used Razor I got the System.Web.Webpages not found error, so due to old habit I went to the project and open the Add Deployed Dependencies dialog and selected the ones for MVC. I've been doing that since 4.6 to have local copies of the MVC dlls before commiting to SVN.
But it seems that these dlls, which I'm pretty sure are for MVC 3, has some conflict with the macro rendering in 4.9 and outputs the html encoded.
After some trial and error I found that I had the System.Web.Webpages that comes from umbraco was not being copied to the bin folder and once I did that the output returned back to normal.
I'm still curious to why the output was encoded with the MVC3 dlls but for now, problem solved.
umbraco 4.9: Why html is always rendered as encoded html
Hi guys,
I'm using 4.9 for the first time and noticed that razor is encoding all the html in the macro even a simple:
is outputed as:
<p>Test</p>
I've also tried:
With the same results.
The macro is included as usual in the template ( even forced the language attribute to make sure..):
Notice that the <p>sdasda</p> is outputed normaly, not encoded:
This didn't happend in 4.7 (the last version I used). Has anything changed? What am I doing wrong?
Thanks for your help!
Have you tried
<p> @Test </p>
?
That won't work as Test is not a variable/property.
The problem I'm having is that instead of outputing just: Test, as you would expect it's doing <p>p;Test</p>
Sorry I must have picked you up wrong.
Maybe flag it is an issue?
This should have been easily noticed by the team. I think I just have something wrong in my configuration... I hope.
This doesn't happen to me with a fresh Umbraco 4.9 install, so it must be something peculiar to you.
Yes.. I am using uSiteBuilder and thought it might have something to do with the macro being in a uSiteBuilder template but tried with a clean template created in the backend an have the same issue..
I'm not aware of any config setting for this, but perhaps if you could performa diff of web.config and /config/umbracoSettings.config between your site and a clean download?
Just did that and the files look the same apart from specific entries related to my website.
And, indeed, the clean version outputs the macro normally... I'm off to a good start.. :)
Maybe you can try this: http://blog.slaks.net/2011/01/dont-call-htmlencode-in-razor.html.
Jeroen
One of the reasons I use uSiteBuilder is to AVOID using Macros'
@Jeroen Breuer, that might work but the issue is that normally you don't need to do that. You just write the html and you're done..
@Richard Terris, cool but I do like to use Macros and razor and have succefully mix it in another project with usitebuilder but that's using 4.7.1..
Haven't got a change to look at it this weekend but I'll let you know if I find something.
Thanks for your input guys!
To my knowledge you don't need to encode HTML unless you have requirements to do so.
<p>Hello</p> should be rendered as Hello in the browser.
Have you tried various browsers? If it's the same in all then I'd suggest It's either a problem with your setup or that version of Umbraco.
You could try this in another project?
Yes, like I said in a previous post. Have tried in a clean solution and works as expected. I'll dig into it this afternoon if I have some spare time.
Please let us know - I'm quite curious about this
Well finally got it and it was my fault. It seems I was using a wrong version of the System.Web.WebPages.
Umbraco 4.9 comes with one along with other MVC dlls, which I referenced in the project BUT forgot to set the Copy Local to true for this dll and some others.
So the first time I used Razor I got the System.Web.Webpages not found error, so due to old habit I went to the project and open the Add Deployed Dependencies dialog and selected the ones for MVC. I've been doing that since 4.6 to have local copies of the MVC dlls before commiting to SVN.
But it seems that these dlls, which I'm pretty sure are for MVC 3, has some conflict with the macro rendering in 4.9 and outputs the html encoded.
After some trial and error I found that I had the System.Web.Webpages that comes from umbraco was not being copied to the bin folder and once I did that the output returned back to normal.
I'm still curious to why the output was encoded with the MVC3 dlls but for now, problem solved.
is working on a reply...