The easiest way is to use Flash to access the user's webcam and place the barcode on the camera. I'm sure Silverlight can do this too.
Regardless of how you cut it, you will need to use some kind of third-party control, whether it be Flash / Silverlight, a Java applet or a browser extension / addon.
An alternative would be to use a particular brand of barcode scanner, whose software can paste the results into an arbitrary text field.
source share