3

I have successfully implemented the Smart Card Reader in my project using the HTML and everything is perfectly 100% working but when i transfer all files to my MVC project and run (localhost) I am unable to execute the Initialize function of the Card Reader. Saying that "Access is denied"

In HTML (all functions are working without access denied error) enter image description here

In MVC enter image description here

My object

<OBJECT id="EIDAWebComponent" style="border:solid 1px gray"
                                        CLASSID="CLSID:A4B3BB86-4A99-3BAE-B211-DB93E8BA008B"
                                        width="130" height="154"></OBJECT>

Update: I created a new ASP.Net Web Application (Empty Template) then i copy the whole js and html file. Then set the HTML page as start page. The problem might be in my localhost. When i browse my file in IE using this link C:\Public Data ActiveX\PublicDataActiveX.html the activex is working. But this link http://localhost:28679/PublicDataActiveX.html its not.

jayvee
  • 160
  • 2
  • 17
  • Why is it initializing to HTTPS? Did you setup HTTPS on your local environment? Did you double-check this URL is correct (by pasting into your browser and verifying it finds the file): `https://localhost:44325/js/eid/eida_webcomponents.js` – Brian Mains Sep 28 '17 at 10:50
  • Yes, I can browse my js file by accessing that url. My application is connected to azure active directory. – jayvee Sep 28 '17 at 10:52

3 Answers3

0

The problem might be simply to enable HTTPS in order to have ActiveX to work.

if your stack makes this hard, you can have a proxy on top, like nginx:

http://cnedelcu.blogspot.com.co/2014/10/https-with-nginx-setting-up-ssl.html

Felipe Valdes
  • 1,998
  • 15
  • 26
  • HTTP is having the same error. I'm sure that the problem is not about SSL. – jayvee Oct 04 '17 at 13:11
  • is the site in a internet explorer zone that allows for the use of activex? did you proceed to add the domain to the list of safe domains under the internet explorer configuration options? – Felipe Valdes Oct 06 '17 at 20:26
0

You just shared a small portion of code and some pics so it is hard to help this way, but below some tips that you may have to consider:

  • When you say, it is working in pure html, what does that mean exactly? how do you browse it, double click in an html file and open in the browser as a local file with a path similar to "C:\Folder\File.hml"?
  • Or do yow browse it with a domain, maybe "localhost/file.html"?
  • When you say, move to an MVC project, what do you mean? did you put it on a View or you just moved the html and browsed it?

All the questions above are important in order to find where your problem is

  • If you can browse the .html file in both situations from file system and running your MVC project then the problem is in the MVC itself and it is a coding stuff.
  • If you cannot browse the same .html exactly the same in file system and running your app, then the problem is not code, it is permissions, Maybe CORS restrictions (by domain), maybe ssl (you said not), maybe you need a key (like google api)
Victor Hugo Terceros
  • 2,969
  • 3
  • 18
  • 31
  • 1. Yes, I am opening the html from directory double click "C:\Folder\File.hml". 2. When i move the file to MVC project, Yes i create a new View and move the html tag/code. – jayvee Oct 08 '17 at 04:06
0

After doing a lot of searching I've found this link

Changing the security settings in IE my ActiveX is now working in localhost.

Open IE >> Tools >> Internet Options >> Security >> Custom Level >>(Enable) Initialize and script ActiveX controls not marked as safe for scripting

jayvee
  • 160
  • 2
  • 17