Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, July 8, 2013 11:50 AM
Hi Guys,
I have a web application that reads weight from the scale and display weight on the text box. I works well on my laptop. However the serve doesn't see the scale after deploying the web site. The server is looking at the local com port not at the client's.
Please help with the code to direct the sever to the client's com port not the local com port.
Regards,
Mike
All replies (12)
Thursday, July 11, 2013 7:15 PM âś…Answered
Hi,
if you really want to check the ActiveX control way to do something on the client side:
http://msdn.microsoft.com/en-us/library/aa229115%28v=vs.60%29.aspx
But that is an old thing at it is simply not recommend to do that. Why did you choose a Web-Application as design? Are there any reasons for that? Simply create a desktop application that will run on the client side. If you need to have a central system to store data or so then simply check web services for the client<->server communication.
And maybe you use something like OneClick deployment to deploy the client application to the clients.
The core question: "How to access the clients serial port from a web application" does not have a simply answer because the client browser simply does not have access to the client system except some simple and easy things. If it would be easy to access the client itself, then visiting a webpage would always be a big risk.
With kind regards,
Konrad
Monday, July 8, 2013 12:13 PM
How are you referencing the serial port in the web application? Is it in HTML code, CS, VBnet? It needs to be using the LocalHost serial port on the client PC.
jdweng
Monday, July 8, 2013 1:08 PM
Hi Jdweng,
Yes I am referencing the serial port in the Web application and using a C# code like this:
using System.IO.Ports;
SerialPort _serialPort;
//Change COM port number
portNumber = COMDownList.Text;
///<summary>
///Create a com port, set it's variables and open it
///</summary>
_serialPort = new SerialPort(portNumber, 9600, Parity.None, 8, StopBits.One);
_serialPort.Handshake = Handshake.None;
_serialPort.ReadTimeout = 500;
_serialPort.WriteTimeout = 500;
_serialPort.RtsEnable = true;
_serialPort.Open();
string data = _serialPort.ReadLine().Trim();
string temp = data.Replace(" kg", "");
Convert.ToDouble(temp);
WeightTextBox.Text = temp.ToString();
_serialPort.Close();
Monday, July 8, 2013 1:43 PM
Hi,
you have to understand web applications. The Client is just showing the HTML pages and executing javascript. All code that you write (c#/vb.Net) is executed on the server.
You cannot execute that code on the client side. That is simply not possible with a web application.
There might be solutions like activex-controls but that would need a local installation and it would limit the clients to windows clients.
With kind regards,
Konrad
Monday, July 8, 2013 2:06 PM
Hi Konrad,
Do you have an example of an ActiveX control example that i can allude to?
Regards,
Mike
Monday, July 8, 2013 3:40 PM
Does your application have Client and Server? The Serial port need to be put into the client code or into a webbrowser application that runs on the client PC.
jdweng
Monday, July 8, 2013 4:43 PM
Hi Jdweng,
My application has a Server and Client computers. The application is running on the Server's IIS and accessed by Client PCs remotely via a Web browser. Ho do I put this code into a browser that runs on the client pc?
Regards,
Mike
Monday, July 8, 2013 4:53 PM
See if webpage below helps
jdweng
Thursday, July 11, 2013 6:59 PM
unfortunately this post has little information. I still haven't found solution for this problem. Guys please help
Saturday, December 28, 2013 4:49 PM
Hii Konrad Neitzel
Ii have UNITECH MS146 slot Barcode reader integrate with ASP.net C# web application
this device is running in more then 15 client system we need to access read
through web application do you can work?
do you have suggestion to run this project successfully?
in this type web application
Saturday, December 28, 2013 4:58 PM
sir i have same problem with reading data from barcode reader in my web application at client side.
Did you find solution?
please reply me on my mail id [email protected]
Wednesday, February 28, 2018 7:23 AM
What is exactly COMDownList.Text. Is access from application or it detected at run time.