how to return a 403 status code on apicontroller action
<p>I want to keep my return type as a string but want the response code to be a 403.</p>

<p>This is what I currently have.</p>

<pre><code>[HttpGet]
public string test(string echoText)
{
    // Not authorized
    if (echoText == "403")
    {
        StatusCode(HttpStatusCode.Forbidden);
        return "";
    }
    else
        return echoText;
}
</code></pre>

<p><strong>UPDATE</strong></p>

<p>I found the below code but is there another way without throwing an exception?</p>

<pre><code>throw new HttpResponseException(HttpStatusCode.Unauthorized);
</code></pre>