ASP.NET MVC - View with master page, how to set title?

后端 未结 11 1008
旧时难觅i
旧时难觅i 2020-12-10 02:50

What is prefered way of setting html title (in head) for view when using master pages?

One way is by using Page.Title in .aspx file, but that requires in master pag

11条回答
  •  情书的邮戳
    2020-12-10 03:25

    We ended up with

    
    

    in master page.

    This way we can read from Page.Title (Page.Title requires head element to exist, otherwise it throws an exception, checked that with reflector). We then use our own head element - MVC way.

提交回复
热议问题