Export (0) Print
Expand All

Controller.Content Method (String, String)

Creates a content result object by using a string and the content type.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

 function Content(
	content : String, 
	contentType : String
) : ContentResult

Parameters

content
Type: System.String
The content to write to the response.
contentType
Type: System.String
The content type (MIME type).

Return Value

Type: System.Web.Mvc.ContentResult
The content result instance.

The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

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.

No code example is currently available or this language may not be supported.

The following example shows the TestContent method.

No code example is currently available or this language may not be supported.
Show:
© 2014 Microsoft