Is there a way to return plain text from web api by just modifying the global.ashx cause I've seen a lot of answers but they all suggested the same which is to convert the return type of each method to plain text in the web api controller?
Asked
Active
Viewed 542 times
0
-
What do you get if you do like `return "Hello"` from a method with signature like `public string Test()`? – Serhiy Chupryk Oct 23 '15 at 05:00
-
5http://stackoverflow.com/q/11581697/2074346 – Kishore Sahasranaman Oct 23 '15 at 05:02
-
@SerhiyChupryk What I'm getting is an XML – Jethro Monzada Oct 23 '15 at 05:09
-
@KishoreSahas yes I've already seen that but what I want to achieve is a Global settings for all my webapi. – Jethro Monzada Oct 23 '15 at 05:10
-
have you tried setting in `Application_BeginRequest` ? as `protected void Application_BeginRequest(Object sender, EventArgs e) { HttpContext.Current.Response.ContentType = "text/html"; }` – Kishore Sahasranaman Oct 23 '15 at 05:20