Controller.Content Method (String, String, Encoding)
Creates a content result object by using a string, the content type, and content encoding.
Namespace: System.Web.Mvc
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
abstract Content : content:string * contentType:string * contentEncoding:Encoding -> ContentResult override Content : content:string * contentType:string * contentEncoding:Encoding -> ContentResult
Parameters
- content
- Type: System.String
The content to write to the response.
- contentType
- Type: System.String
The content type (MIME type).
- contentEncoding
- Type: System.Text.Encoding
The content encoding.
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.
The following example shows the TestContent method.
Show: