title: Send data from console application to asp.net website
body: <p>I am quite new to C# and .NET and I have started working on a small local application.</p>
  
  <p>In one visual studio solution, I should create a website than can retrieve messages written from a console application and display / store them in a database.</p>
  
  <p>I was mostly wondering if there is any "preferred" way of doing it.</p>
  
  <p>At the time, I have come up with two possible ways of doing it I think.</p>
  
  <p><strong>The first method</strong>
  Console Application <strong>CA</strong> References Website MVC Application <strong>WA</strong> which has a model class called Message. (it is simply a message i want to transfer)</p>
  
  <p>When a user inputs text into a command line and hits enter, a new Message is created with that text. From there, I was thinking to use the <code>&lt;% ViewData["Variable"]%&gt;</code> to pass the information.  Is this a good way of doing it?</p>
  
  <p><strong>The second method</strong> which I has not tested yet:
  My initial thought was to create a http connection and send a POST request to the website. I briefly read about creating a Web API application that would handle this.</p>
  
  <p>Is there any other "standard" or preferred ways of solving the task?</p>
  
  <p>I am looking for an efficient way of doing it along with testability.</p>
  
  <p>/<em>If anyone ends up here, you can check out the result of this</em>/
  <a href="https://github.com/egenvall/ConsoleToBrowser" rel="nofollow">https://github.com/egenvall/ConsoleToBrowser</a></p>