Firewall custom properties not populated

I created my own razor base class class and added some properties to facilitate my development, but the problem is that you are not populated!

here base class custom code

    public abstract class WebViewPage<TModel> : System.Web.Mvc.WebViewPage<TModel>
{
    public string MetaTagKeywords { get; set; }
    public string MetaTagDescription { get; set; }
    public string MetaTagTitle { get; set; }
    public string ExtraScripts { get; set; }
}

public abstract class WebViewPage : WebViewPage<dynamic>
{
}

and this is what i do in razor mode to fill it

@MetaTagTitle =" test title" 
+3
source share
1 answer

Shaver Code:

@MetaTagTitle =" test title" 

Does not complete the assignment, but displays the contents of the MetaTagTitle, followed by the rest of the line.

This translates to something like this (not really, just to get the point):

Response.Write(Html.Encode(MetaTagTitle));
Response.Write(" = \" test title\"");

What you need:

@{ MetaTagTitle = "test title"; }

This will lead to code execution and will not display it.

+6
source

Source: https://habr.com/ru/post/1786628/


All Articles