SexyMF
SexyMF

Reputation: 11155

How to return blank view in C# MVC 3

I want to return a for a certain controller a blank page.

By blank, i mean blank!. with no Site.Master contents.

How? Thanks

Upvotes: 9

Views: 8673

Answers (3)

TYRONEMICHAEL
TYRONEMICHAEL

Reputation: 4244

Are you wanting to return a page that does not inherit from your master page? If so then in your view page, do the below

@{
     Layout = null;     
 }

Upvotes: 0

Joshua H
Joshua H

Reputation: 839

This will return an empty view

public ActionResult MyAction()
{
    return new EmptyResult();
}

Upvotes: 23

Daniel A. White
Daniel A. White

Reputation: 190907

if you want no html or content, just return null from your action method.

Upvotes: 0

Related Questions