Controller.Content Method (String, String)
Visual Studio 2010
Creates a content result object by using a string and the content type.
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
Parameters
- content
- Type: System.String
The content to write to the response.
- contentType
- Type: System.String
The content type (MIME type).
A Visual Studio project with source code is available to accompany this topic: Download.
The example in this section shows how to use markup and code to display "Use <b> for bold text" in the browser when the Test Content link is clicked.
The following example shows markup that invokes the TestContent method.
<%= Html.ActionLink("Test Content with Type", "TstContentConType", new { id = false, sMsg="Use <b> for bold text"})%>
The following example shows the TestContent method.
Community Additions
ADD
Show: