Access denied in ActiveX after moving the javascripts in MVC

Viewed 702

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.

3 Answers

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)

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

Related