开发者

asp.net mvc razor: How to directly access .cshtml page?

How can i directly access a .cshtml file in A开发者_JS百科SP.NET MVC using razor view engine?

For example i have this url: localhost/Home/About. This will load the about site inside the "master" page.

I want to load the about page without also loading the master page. So i was thinking that i could use this url: localhost/Home/About.cshtml. But it's not working.

How can i load a view page without loading the master page?


You can use the method Html.Partial like this:

@Html.Partial("About")

Edit

I might have missunderstood your question. If you want to avoid including the master page you need to remove the layout.

Add this to the top of your View:

@{
     Layout = null;
 }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜