Chuck Norris
Chuck Norris

Reputation: 15190

How to use Razor Layout as Master Page in ASP.NET MVC

I am using ASP.NET MVC 3 and have some parts 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've already create Layout for site using Razor's Layout and I want to use that layout in this .aspx file too.
How can i achieve this?

Upvotes: 8

Views: 16822

Answers (3)

Steen T&#248;ttrup
Steen T&#248;ttrup

Reputation: 3835

I'm pretty sure you can not mix the 2 different view engines (The Razor view engine and the old ASPX view engine).

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

You cannot use Razor layouts with WebForms views. You will need to create a WebForms masterpage for WebForms views. View engines cannot be mixed like this.

Upvotes: 6

Related Questions