Click here to Skip to main content
13,049,233 members (63,513 online)
Rate this:
Please Sign up or sign in to vote.
I have used vs2010 and silverlight 5 to access scanner in web browser. When i host the application on iis7, i can able to access scanner in Mozilla but does not in internet explorer. why the IE browser does not support to access scanner in web browser?

I made changes in,
Server side
• Sign the xap using certificate.
Client side
• Install the cert into “trusted publishers”
• Change the reg key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Silverlight \AllowElevatedTrustAppsInBrowser” to 1

My code is,
    using (dynamic CommonDialog = AutomationFactory.CreateObject("WIA.CommonDialog"))
        dynamic imageFile = CommonDialog.ShowAcquireImage();
        if (imageFile != null)
            if (!Directory.Exists("D:\\ScanImage"))
            string filePath = string.Format("D:\\ScanImage\\{0}.jpg", Guid.NewGuid());
catch (System.Runtime.InteropServices.COMException ex)
    if (ex.ErrorCode == -2145320939)
        MessageBox.Show("Could not find an attached scanner.", "Scanner Error", MessageBoxButton.OK);
        MessageBox.Show(ex.Message, "Scanner Error", MessageBoxButton.OK);

Thanks in advance
Posted 17-Apr-13 23:42pm
Updated 18-Apr-13 0:29am
Neha G. Nagpurkar 20-Jun-13 7:35am
Can I get demo application for this? I have been searching for last 2 weeks. Thanks in advance.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Maybe the examples here can help you out:[^]

Good luck!
Sugu.s 18-Apr-13 7:05am
Hi Nijboer,

I was tried all these parameters in ShowAcquireImage Method. But not working.
E.F. Nijboer 18-Apr-13 7:16am
Maybe this info helps, there seems to be another reg key:
Sugu.s 18-Apr-13 7:40am
If i open browser with Run as Administrator (with Administrator permissions), able to access scanner. do you have any idea without admin permission to access.
E.F. Nijboer 18-Apr-13 8:21am
Seems you need to give non-admin users the correct permission. There is some info on that on the above link, like info on Group Policy Settings. I don't know exactly whats wrong. It is also strange that Firefox does work, or are you always running that as administrator?
Also have a look here:
Sugu.s 22-Apr-13 7:15am
I was tried all group policy settings and all above given link details, nothing to work. Any idea tell me ASAP
E.F. Nijboer 22-Apr-13 7:27am
I really wouldn't have any idea because there is to little info on what the problem might be. Have you checked the event log?
Sugu.s 24-Apr-13 4:26am
I got error when access scanner

Message: Unhandled Error in Silverlight Application Failed to create an object instance for the specified ProgID.
at MS.Internal.Error.MarshalXresultAsException(UInt32 hr, COMExceptionBehavior comExceptionBehavior)

at MS.Internal.XcpImports.CheckHResult(UInt32 hr)

at MS.Internal.ComAutomation.ComAutomationNative.CreateObject(String progID, IntPtr& nativeObject)

at MS.Internal.ComAutomation.ComAutomationServices.CreateObject(String progID, ComAutomationParamWrapService paramWrapService)

at System.Runtime.InteropServices.Automation.AutomationFactory.CreateObject(String progID)

at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
E.F. Nijboer 24-Apr-13 4:54am
Have you tried google on the first line? ;-)
Sugu.s 24-Apr-13 5:26am
Thanks for response.
I don't want to know how to set OOB in Silverlight 4. My requirement is elevated trust and in browser together for Silverlight 5 web application.
E.F. Nijboer 24-Apr-13 6:03am
Wouldn't the example work in sl5 too?
Sugu.s 24-Apr-13 5:27am
I have another issue. If i browse with Run as Administrator on windows 7, everything working fine. At same time i was not able to get either function to work on machine (windows XP). How to work with windows XP.
E.F. Nijboer 24-Apr-13 6:03am
Angela 10293848 23-Jan-14 1:44am
could you resolve the problem with windows xp?I have a same problem,my code dose not work on windows sp
E.F. Nijboer 23-Jan-14 7:50am
If the answer isn't in one of the links already I would suggest to "Ask a Question" yourself here on codeproject, explaining your situation with some more details.
Angela 10293848 23-Jan-14 8:34am
I have problem in xp not in browser
E.F. Nijboer 23-Jan-14 9:59am
It would be better to create your own question because this is not the place to post a question. You could mention this question if it would help making your own question more clear but your problem is OS related and this is browser related, so not really the same problem actually.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


To work in IE, Just change ElevatedPermissions="Required" in InBrowserSettings.xml
    <SecuritySettings ElevatedPermissions="Required" />
    <!--<SecuritySettings ElevatedPermissions="NotRequired" /> This is default-->
Sugu.s 17-Dec-13 0:56am
Hi, already the ElevatedPermissions set as Required.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Another approach can be using a web-based scanner ActiveX/plugin. Here [^] is a demo app you can try.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Mar 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100