Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6324247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:40:07+00:00 2026-05-24T16:40:07+00:00

Is it possible to add a serial port control to a web application. I’ve

  • 0

Is it possible to add a serial port control to a web application. I’ve tried creating one programmatically, but i have issues with the port staying open. I’m not sure how to fix that except by adding a serial port control somehow to the web page. Any ideas on how I can accomplish this task? Thanks in advance.

the following is the code I currently have:

public partial class LoadCellTest : System.Web.UI.Page
{ 
SerialPort serialPort1 = new SerialPort("COM3",9600,Parity.None,8,StopBits.One);

 protected void Page_Load(object sender, EventArgs e)
{

    serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1_DataReceived);
    serialPort1.ErrorReceived += new SerialErrorReceivedEventHandler(serialPort1_ErrorReceived);

}

delegate void SerialDataReceivedDelegate(object sender, SerialDataReceivedEventArgs e);
delegate void SerialErrorReceivedDelegate(object sender, SerialErrorReceivedEventArgs e);


protected void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
   TextBox1.Text = (serialPort1.ReadExisting());
   if (serialPort1.ReadExisting().Length == 0)
   {
       ListBox1.Items.Insert(0, TextBox1.Text);
       TextBox1.Text = "";
   }
}
protected void button1_Click(object sender, EventArgs e)
{
    try
    {
        if (serialPort1.IsOpen)
        {
            serialPort1.Close();
            button1.Text = "Start";
        }
        else
        {
            serialPort1.Open();
            button1.Text = "Stop";
        }
    }
    catch (IOException ex)
    {
        MessageBox.Show(ex.Message);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:40:08+00:00Added an answer on May 24, 2026 at 4:40 pm

    Turning my comments into an answer…

    The serial port code is server-side code. You can’t do it on the client with ASP.NET.

    Creating an ActiveX or other fat client control is a load of work, and just not a good idea.

    My recommendation would be to continue on with your WinForms app for the code where you need the scanner, and add a menu to it to enable you to launch a separate ASP.NET web app for the reports/data access.

    If you want to make it more “seamless” for the users, you can add a form with a WebBrowser control that loads your report/data access site. To them it will just be a “part of the application”.

    THAT SAID, depending on the device you have connected to the port, there may be an even simpler option.

    One of our barcode scanners comes with software that just takes barcode data as it’s scanned and pastes it into whatever open document has focus. If you’re working in Notepad, the scanned data is pasted into Notepad. If you have a web app open, and the cursor in a text box, the data simply pastes in there.

    It’s a simpler option to implement, BUT it’s harder on the users, because if they’re not technical, they’re going to call you wondering why the barcode beeps but doesn’t populate the text box. (The answer will be “Because your cursor isn’t in the text box or the form doesn’t have focus”)

    So I go back to recommendation #1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to add instances of the same user control when an add
Is it possible to add a custom tab to a project properties page in
Is it possible to add attributes at runtime or to change the value of
Is it possible to add an image overlay to a google map that scales
Is it possible to add custom command-line arguments to an Eclipse .app folder? In
Is it possible to add a jQuery function so that a click in a
Is it possible to add a metadata-like description or comments to a table in
Is it possible to add checkboxes to the WPF TreeView object? I'd like to
Is it possible to add rows to a dataset?
It is possible to add and remove elements from an enum in Java at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.