---
title: "How to return string result in mvc?"  
description: "How to return string result in mvc?"  
author: "Anonymous User"  
published: 2014-11-18  
updated: 2014-11-18  
canonical: https://www.mindstick.com/forum/12628/how-to-return-string-result-in-mvc  
category: "asp.net mvc"  
tags: ["ajax", "asp.net mvc"]  
reading_time: 1 minute  

---

# How to return string result in mvc?

In my [ajax](https://www.mindstick.com/articles/1541/check-availability-of-user-name-or-email-using-asp-dot-net-ajax-and-jquery) call, I want to return a [string value](https://www.mindstick.com/forum/159623/how-to-get-an-enum-value-from-a-string-value-in-c-sharp) back to the calling page.

Should I use [ActionResult](https://www.mindstick.com/forum/33961/what-is-the-difference-between-actionresult-and-viewresult) or just return a string?

## Replies

### Reply by Mark Devid

You can just use the ContentResult to return a plain [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp):

```
public ActionResult Temp() {    return Content("Hi there!");}
```

ContentResult by default returns a text/plain as its contentType. This is overloadable so you can also do:

return Content("<xml>This is poorly formatted xml.</xml>", "text/xml");


---

Original Source: https://www.mindstick.com/forum/12628/how-to-return-string-result-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
