Created
April 20, 2015 19:38
-
-
Save johnmmoss/0596a3e88e3f9b67d7fd to your computer and use it in GitHub Desktop.
ASP.NET MVC Content type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ContentResult Content() | |
{ | |
var content = new ContentResult(); | |
content.Content = "<html><body bgcolor=\"red\"><p>This is my HTML content</body></html>"; | |
content.ContentType = "text/html"; | |
return content; | |
} | |
public ContentResult ContentXml() | |
{ | |
var content = new ContentResult(); | |
content.Content = "<books><book>one</book><book>two</book></books>"; | |
content.ContentType = "text/xml"; | |
return content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment