title: Redirecting from an API
body: <p>I am trying to learn/expand my knowledge of .NET MVC/REST/API's and Web-sockets/SignalR. To do this I am implementing a chat app.</p>
  
  <p>I have a typical MVC intro page that gets the users name and email address in a form and that data is submitted to a RESTFul API where the new user is added to the database.</p>
  
  <pre><code>&lt;form class="form-horizontal" role="form" action="/api/GroopsAPIUsers" method="POST"&gt;
  </code></pre>
  
  <p>Inside of the controller for that page(?) I'm redirecting the user to a page where they can select which room they would like to enter.</p>
  
  <pre><code>public HttpResponseMessage  Post( GroopsUser userValue)
  {
       userValue.ID =  Guid.NewGuid();
       bool results = groopsRepository.AddNewUser(userValue);
       //   return results;
  
       var response = Request.CreateResponse(HttpStatusCode.Redirect);
  
        //from http://stackoverflow.com/questions/11324711/redirect-from-asp-net-web-api-post-action
  
       string fullyQualifiedUrl = Request.RequestUri.GetLeftPart(UriPartial.Authority);
       response.Headers.Location = new Uri (fullyQualifiedUrl + "/home/rooms/?userID=" + userValue.ID);
  
       return response;
  
  }
  </code></pre>
  
  <p>But this doesn't feel right. It seems like the API should only be doing CRUD operations and shouldn't have anything to do with which page the user is redirected to. </p>
  
  <p>Is this the wrong approach?
  If so, can someone point me in the right direction?
  (I'm not sure that I've used all of these terms correctly)</p>
  
  <p>...gregory</p>