Xordal
Xordal

Reputation: 1369

Deleting comments in MVC view

I want to include html-comment in my view (mvc3-app):

<!-- comment -->

but Razor delete this code on render page. I try to use

@Html.Raw ("<!-- Comment -->")

but without result.

p.s. i need to use comment for google-adsense targeting.

edited: Add Html.Raw result

Left side -> VS code. Right side -> FireBug

Html.Raw

Upvotes: 3

Views: 395

Answers (1)

Shad
Shad

Reputation: 4464

Razor view engine deletes from resulting markup 'server-side' comments within a @* ... *@ block, but it keeps 'client-side' comments (i.e. HTML comments) - <!-- ... -->.

They can be deleted by your browser markup viewer. Try to open full page markup or view it in another tool.

Upvotes: 2

Related Questions