How to capture image from client webcam in asp.net - asp.net

I am working on an ASP.Net application and I want users to be able to take a picture with their local webcam and then upload it to the server.
I can, of course, rely on users doing this manually via their locally installed software, save the image as a file and do a normal file upload. However, what I really want to do is incorporate it all into a UI in the browser.
I know this means accessing local resources so do I need an ActiveX control or Silverlight or is there something I could do in Javascript for example?
This is initially intended for an Intranet app so I can have control of the client's environemnt, including stipulating the browser etc, which means I can use an ActiveX control if I have to. However, it would be nice if I could write this in a generic way so it could be used in an internet app generally (happy to stipulate that it only works on Windows clients but would be good to get it to work in FireFox).
Thanks.

The only acceptable and universal way to this for now is Flash/Flex application. Flash player presets literally in every browser in the world and all of them has such capability.

VideoCap Pro is quite popular, and it offers an ActiveX version, have you checked it out?

This sounds very suspicious to me. You realize the nefarious applications this could be applied to, right? A web page that when a user browses to it, unknownst to them, their webcam snaps a pic of them. ... I don't like it.

You could use the Nimbb API to do the webcam video recording inside a browser.

It is possible to get the image from client webcam in asp.net, you have to install the Silverlight 4 with Visual Studio 2010:
Go to following link:
http://wildermuth.com/2009/11/23/Taking_a_WebCam_Photo_with_Silverlight

Related

Scan an image from asp.net

how can i scan an image from a webpage in asp.net.
I need a free control or a code to scan an image from a scanner in
any user that requests the webpage.
Thank you.
It is not like you can't do it. But it is not a scalable option in my opinion.
You can use ActiveX control - But that won't work in all browsers.
You can't use Windows Image Acquisition library directly from ASP.NET on the client side, since the code would run at the server.
Why not simply have the image uploaded?

ASP.NET: Record Sound From A Web App?

I'm contemplating adding a voice recording to some posts on my site. I'm wondering if there is an ASP.NET library out there that will allow me to:
Press a button to start recording
Record what I'm saying through my comp's built in microphone
Save the file as a .wav or some other popular sound file
As of now, I will be the sole user of this function, but it would still be nice to have in my bag of tricks in case I want to pull it out later for a client.
It is not doable without the help of a plugin. Browsers simply don't support voice recording.
You could choose from:
Make a SilverLight applet.
The flashPlayer can record too.
find a java Applet that can do this.
Make an activeX Plugin (since you have affinity to asp)
use your os provided voice recorder, save the file and upload it. Playback via browser is easy
You solution will involve a flash componet (outside of rendering the markup that invokes the flash component). The ASP.NET stack won't be able to do it. Silverlight doesn't seem able to do it.
Here is how.
Here's the problem: the browser does not allow this level of hardware access by an application. You could however achieve this either through Java, Flash or ActiveX (Yuk! don't do it) should the end user allow the access to occur however there are a number of cavaets. Here's a great thread where like-minded people like yourself are approaching the same challenge:
http://drupal.org/node/69242
If I were cornered to do this I would create a signed Java Applet.
not directly from asp.net since asp.net is server side and you need access to the client side microphone - however the new adobe flash player has the ability to access the mircophone so in theory you could use flash to record then upload to your site.
See ListenUp sdk. I found a bulletin board called english-test.net that is using the sdk to post voices.
You'll need some client-side code to achieve this as regular HTML doesn't support audio input and upload.
The ActiveX control Active Audio Record 2.0 claims to support recording audio and uploading it to an ASP.NET web server. I've never tried it though.

How to get list of drives on local system using ASP.Net

I am going to develope a module in ASP.Net. In this module I want to get the list of drives of the local system where this page is displaying. I have already tring with System.IO.... etc. but it gives me the server drives.
I want to get the list of LOCAL drive where page is displaying on server drives.
Thank you.
Do you mean the client's computer's drives?
That is not possible.
EDIT: However, it is possible with ActiveX or a browser plug in.
This absolutely cannot be done with neither server-side ASP.NET, nor with client-side JavaScript. You can try writing an ActiveX "control" (or how are these called?) or Java applet.
Fortunately you can not do that.
This is impossible, since your ASP.Net code runs on the server. The client only sees the rendered page (HTML and javascript).
Remember: your C# or VB.Net code runs on the server for the explicit purpose of sending html/javascript to the client browser. It does not get to peek directly at the "local" system, and the only thing the "local" system knows about is the html/javascript rendered on the server. That's just how the web works.
Furthermore, javascript runs in a sandbox that does not include any way to enumerate the local drives. This is by design.
So the only way to do this is via plug-in like flash, silverlight, or activex.
You can write a .NET control which is downloaded from your website to the clients' PC and looks at the drives there. As this could be abused (you could steal the users' files) you will have to convince the user to download the control in the first place. Look here for more info:
ClickOnce Deployment overview

Flex FileReference.download - is it possible to open associated application

When using FileReference.download() to retrieve a file from a server, I'd like to give the user the option to open the associated application directly rather than having to save it to disk first.
Is this possible in Flex 3? And, if so, how is it done!
Thanks,
Mark
ps. I've tried doing URLLoader.load(URLRequest) also, but no dice...
navigateToURL(urlReq, "_blank") works in most cases, but do not open Excel, CSV files(MS office apps) in IE 7 and older versions.
Nope, you can't do that unfortunately. My guess is that this is due to security restrictions.
From a web application this is most certainly not possible. It might be possible from an AIR application by asking the operating system to handle the opening of the file and leave it at that. Windows and OS X should be able to handle it gracefully.
Why Adobe restricts such actions from web applications makes sense. It would be a glaring oppurtunity for anyone to create a regular site with a flash app that downloads and runs a virus without the user actually knowing anything about it.

How to interact between Web App and Windows Form Application

I have a problem where a Web Application needs to (after interaction from the user via Javascript)
1) open a Windows Forms Application
2) send a parameter to the app (e.g. an ID)
Correspondingly, the Windows Forms Application should be able to
1) send parameters back to the Web Application (updating the URL is ok)
2) open the Web App in a new brower, if it does not exist
If many browser windows are open it's important that the correct one is updated.
Windows Forms Application is in ASP.NET
Browser is IE6+
The applications are controlled and internal for a specific organisation so it's not a question of launching a custom app.
Question A) Is this possible?
Question B) How do I send parameters to an open Windows Forms Application from a Web App?
Question C) If updating the Web App, how do I make sure the right browser is targeted?
What you're asking for is possible but seems awkward.
Trying to call an application from a web page is not something you could do due to security considerations. You could however make a desktop application which would be associated with a certain type of files and then use content-type on the web page to make sure that your app is called when a URL with this type is opened. It would be similar to the way MS Office handles .doc or .xls documents or the Media Player opens the .mp3 or .wmv files.
The second part (opening a particular web page from your application) is easier.
As you should know the address of your web page create a URL string with the parameters you want and open it in default browser (there are plenty of examples on how to do that, a sample is below).
System.Diagnostics.Process.Start("http://example.com?key=value");
If you want to update the page in the already opened browser or use a browser of your choice (i.e. always IE6 instead of Opera or Chrome) then you'll have to do some homework but it's still quite easy.
PokeIn library connects you desktop application to your web application in real time/per user. Moreover, due to its reverse ajax state management, you could consider both of your applications as one.
Check out
http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx
Using VBScript in your Web Page you can call an open Windows Forms application and send keys to it.
This only works on IE though and you need to adjust the security settings to allow ActiveX.
Have a look into "registered protocols" (for example here and here). I know Skype does this to make outward phone calls from a web page. But probably some changes will be needed in the win application to intercept the parameters from the url.
I haven't tried this but it should be possible
No I don't think it's possible.
Think of viruses/trojans/spyware. If it were possible to launch an application from a mere HTML page, it would be very easy to install malware.
Browsers are designed to prevent you from doing that.
You could use clickonce to deploy and start the forms app - this should take care of sending the parameter to the app.
While this may not perfectly fit with your application, what about using a web service and the form?
Also, you can pass parameters to ensure IE6, not Firefox opens.
System.Diagnostics.Process.Start("c:\ie6\ie6.exe http://www.example.com/mypage");
Ok, so I actually found a clue to the web -> winform part.
The following code was handed to me from an web application that sends a parameter to a winform app. I assume this solution has some security factors in play (such as allowing running VBScript (and ActiveX?) in the webpage. That's ok for me though.
The code:
<script type="text/vbscript" language="vbscript">
<!--
Function OpenWinformApp(chSocialSecurityNumber)
Dim oWinformAppWebStart
Set oWinformAppWebStart = CreateObject("WinformAppWebStart.CWinformAppWebStart")
oWinformAppWebStart.OpenPersonForm CStr(chSocialSecurityNumber)
End Function
-->
</script>

Resources