简体   繁体   中英

How can I send and receive data to a serial port or USB port in ASP.NET?

I am developing a web application for a parking. I want to control a gateway entrance with a device connected to USB port, but we know that the browser is in a sandbox , so there isn't any access to the computer's port.

I searched the web and found out there is some possibility to do so via ActiveX and/or Java applets , but I'm a novice to these things and want a complete tutorial or a wiki book that describe it or even class libraries relative to.

I want to send data to a USB or COM port via an ASP.NET application (client side). I know that browsers aren't able to do so because of security issues. What would be an example of using ActiveX?

You need to host an ASP.NET application/website on a server . Your browser is on a client machine. Your client will request a page from the server and the website could not be hosted on the client machine .

So you can connect your device to a server machine and the client sends you request to post data through a device, eg a GSM modem. Now you need to connect your device to the server and you can make a Windows service to pull the posted message from the database to post them through the device.

You need to talk to a COM port. Even your USB devices listen to a COM port. You can use the serial port class to communicate with the device. You can do this with a desktop application and I could not see any reason for using a website . The following links will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM