Results 1 to 1 of 1

Thread: Security Permission Problem with my ActiveX Control

  1. #1

    Thread Starter
    Fanatic Member daimous's Avatar
    Join Date
    Aug 2005
    Posts
    657

    Security Permission Problem with my ActiveX Control

    Hi guys help please...I've created ActiveX Control using C# 2005 and I was able to compile it successfully but when i try to deploy it in our IIS server and open it thru my IE it shows an error.(Please see attached image) The error occured when I clicked the button btnLstRdr on my ActiveX Control. Any help please to solved this? Thanks in advance!

    Code Snippet:
    Code:
            private void btnLstRdr_Click(object sender, EventArgs e)
            {
                string[] rlist;            
                cmboReaderList.Items.Clear();
                if (FuncListReader(out rlist))
                {
                    foreach (string str in rlist)
                    {
                        if (str != "")                        
                            cmboReaderList.Items.Add(str);
                    }
                }
            }
    
            public bool FuncListReader(out string[] readerList)
            {
                int ReaderCount = 255;
                byte[] retData;
                byte[] sReaderGroup = null;
                string readerStr = string.Empty;
                //string[] readerList;
                readerList = null;
    
    
                Common.retCode = ModWinsCard.SCardListReaders(Common.hContext, null, null, ref ReaderCount);
    
                if (Common.retCode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    FuncShowErrorMsg("Error getting list of reader.", ModWinsCard.GetScardErrMsg(Common.retCode), "Error getting reader list");
                    return false;
                }
    
                retData = new byte[ReaderCount];
    
                //Get the list of reader present again but this time add sReaderGroup, retData as 2rd & 3rd parameter respectively.
                Common.retCode = ModWinsCard.SCardListReaders(Common.hContext, sReaderGroup, retData, ref ReaderCount);
    
                if (Common.retCode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    FuncShowErrorMsg("Error getting list of reader.", ModWinsCard.GetScardErrMsg(Common.retCode), "Error getting reader list");
                    return false;
                }
    
                //Convert retData(Hexadecimal) value to String 
                readerStr = System.Text.ASCIIEncoding.ASCII.GetString(retData);
                readerList = readerStr.Split('\0');
    
                return true;
            }
    
    
            [DllImport("winscard.dll", EntryPoint = "SCardListReadersA", CharSet = CharSet.Ansi)]
            public static extern int SCardListReaders(
                int hContext,
                byte[] Groups,
                byte[] Readers,
                ref int pcchReaders
                );
    Attached Images Attached Images  
    Last edited by daimous; Oct 17th, 2008 at 05:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width