title: read input from serial port c# asp.net?
body: <p>Hello I have a PIC16F877A micro-controller and Lcd display. I have made PIC controller to display random numbers in the LCD screen for every 2mins and it also send those randomly generated number to my laptop for every 2 mins through RS232 cable. I am creating a website using ASP.NET 4 C# where I want to read those numbers and do functions. I have written the following coding but its not working but I am receiving those random numbers in my laptop hyper-terminal. Please suggest me how to achieve this - I have to receive those codes every 2mins. </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.IO.Ports;
  
  public partial class Entercode : System.Web.UI.Page
  {
      static SerialPort mySerialPort = new SerialPort("COM46", 1200, Parity.None, 8,     StopBits.One);
      protected void Page_Load(object sender, EventArgs e)
      {
          mySerialPort.Open();
          String str = mySerialPort.ReadLine();
          mySerialPort.Close();
  
      }
  }
  </code></pre>