PDA

Click to See Complete Forum and Search --> : Security Permission Problem with my ActiveX Control


daimous
Oct 17th, 2008, 03:05 AM
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:

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
);