开发者

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

开发者 https://www.devze.com 2023-04-01 00:22 出处:网络
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

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?


I recently blogged about this at here,

http://weblogs.asp.net/imranbaloch/archive/2011/09/01/a-webform-view-with-a-razor-layout-in-asp-net-mvc-3.aspx


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消