How to use the Razor layout as the main page in ASP.NET MVC

I am using ASP.NET MVC 3 and some parts are written using aspx. So, in some of my views, I have something like this

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="Thread.Index" %> 

But I already created a Layout for the site using Razor Layout, and I want to use this layout in this .aspx file too. How can I achieve this?

+7
source share
3 answers

You cannot use Razor layouts with WebForms views. You will need to create a WebForms master page for WebForms views. Viewing mechanisms cannot be mixed in this way.

+6
source

I am sure that you cannot mix two different viewers (the Razor viewer and the old ASPX viewer).

+1
source

All Articles