serial port access from asp.net

G

Guest

I need to access the serial ports on my webserver from an asp.net page. I
have no problem accessing the serial ports from a windows form application,
but the code doesn't work in asp.net. I have been told it is not possible to
access the serial ports from asp.net.

The application is used to control custom hardware. The hardware is
connected to a PC through serial ports. Our customer wants to control the
hardware from a remote location so our idea was to have IIS running on the PC
and the recorder controlled through a web page.
 
E

Eliyahu Goldin

I would consider a solution with a windows service controlling the device
and an ASP.NET application talking to the windows service via a common
persistent data storage, such as a file.

Eliyahu
 
B

Brock Allen

There are no managed APIs to connect to the serial port in v1.x. There are
in v2.0 though. If you need a solution now, you'll have to write unmanaged
code and then interop to access it.
 
G

Guest

Accessing the serial ports in .net is not the problem. Accessing the serial
ports in asp.net is the problem. Code that accesses the serial ports in a
Windows form application does not work in a asp.net application.
 
E

Elton Wang

It's a good idea. To build a middle layer data file and
use FileSystemWatcher object to monitor the data file and
trigger event.

Elton
 
K

Kevin Spencer

Accessing the serial ports in .net is not the problem. Accessing the
serial
ports in asp.net is the problem. Code that accesses the serial ports in a
Windows form application does not work in a asp.net application.

An ASP.Net application is a .Net application, just as a Windows Form
application is a .Net application. There is nothing you can do in a Windows
Form app that you can't do in an ASP.Net app, except with regards to the UI.

IOW, yes you can access a serial port in an ASP.Net app. Or, let me clarify:
yes -I- can access a serial port in an ASP.Net app.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

I use the serial port code that was published in MSDN magazine. It works for
Windows Forms applications. It does not work in ASP.net. I have been told
by many people you cannot access serial ports from ASP.net. Telling me you
can access the serial ports doesn't do me any good.
 
K

Kevin Spencer

I use the serial port code that was published in MSDN magazine. It works
for
Windows Forms applications. It does not work in ASP.net. I have been
told
by many people you cannot access serial ports from ASP.net. Telling me
you
can access the serial ports doesn't do me any good.

Copying and pasting is not programming. And IT doesn't do you any good.

Hmmmm.... Why would code that is written for, and works for a Windows Forms
app not work in an ASP.Net app? Well, I haven't seen it, so I'll have to ask
The Amazing Kreskin..... he says it's permissions.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
E

Eliyahu Goldin

An ASP.Net application is a .Net application, just as a Windows Form
application is a .Net application. There is nothing you can do in a Windows
Form app that you can't do in an ASP.Net app, except with regards to the
UI.

Some tasks are definitely not good for ASP.NET. For example, multithreading.
And recently someone asked about watching a directory from an ASP.NET
application. Although you can use a filewatcher during the page lifetime, it
obviously doesn't serve any purpose .

Eliyahu
 
G

Guest

The problem is not permissions. ASPNET and IUSR have administrator
priviledges on the computer. The Windows API calls for serial ports don't
work under ASP.net.
 
K

Kevin Spencer

The problem is not permissions. ASPNET and IUSR have administrator
priviledges on the computer. The Windows API calls for serial ports don't
work under ASP.net.

Well, darn. I suppose my apps only LOOK like they work...

Then again, I didn't copy them from anything.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

Since you are unable to supply any useful information I can only assume you
don't know anything. Judging by your attitude you are probably a teenager.
 
K

Kevin Spencer

Since you are unable to supply any useful information I can only assume
you
don't know anything. Judging by your attitude you are probably a
teenager.

Well, you're wrong on point 2 - I am 49 years old. Could it be that you're
wrong about anything else? Well, logically, one could make that prediction.

If by "unable to supply any useful information" you mean I can't write your
code for you, your assumption is patently incorrect. I am perfectly capable
of writing code, yours or anyone else's. However, we seem to have a
disagreement about how "useful" my advice is.

If your child asked you for a piece of cake just before dinner, would you be
helping him/her by giving it to him/her? Similarly, I try to help people by
telling them what they need to know, not necessarily what they think they
want to know. Yeah, I know, it doesn't taste like cake. But it's good for
you!

Let me illustrate by quoting you:

This statement is full of assumptions, almost all of them wrong. It
indicates that you can't seem to write code for yourself, that you copied
code from an example without studying and understanding it, and that you
assume the fault is with the platform. Getting a feed from a serial port is
an academic exercise. Knowing how to program, understanding logic, and best
practices are indispensible. If I wrote code for you that accesses a serial
port, you would have a small problem solved, but the cause ignored. If, on
the other hand, you learn how to really program, not just put pieces
together like a Jigsaw puzzle, and you disciplined your logic, and learned
and practiced best practices, the first problem would be solved, and any
future problems of that nature would disappear.

So, if I'm guilty of being "useless," perhaps it's your idea of "useless"
that is at fault.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
Joined
Sep 29, 2007
Messages
1
Reaction score
0
I may have a solution!!

:wave:

I may have a solution!! do you still need it.

To Kevin Spencer:
:withstup:
46 years old!! And you haven’t grown yet? This man what it needs help with a technical problem. Not jokes from a f***er who most likely has the same problem. You suck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top