Click here to Skip to main content
15,906,081 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use the following code in C# to send sms from my PC, there was no problem.

private SmsSubmitPdu pdu;
protected void btnSend_Click(object sender, EventArgs e)
{
    string port = "COM4";
    Int32 baudRate = 9600;

    GsmCommMain comm = new GsmCommMain(port, baudRate, 300);

    try
    {
        comm.Open();
        pdu = new SmsSubmitPdu("Hi I am Sayed", "01738169709", "");
        comm.SendMessage(pdu);
        comm.Close();
        lblError.Text = "Message sent";
    }

    catch (Exception ex)
    {
        lblError.Text = ex.ToString();
    }
}


VB
But when I work on same code in ASP.net, then error have come in my label box.
Error:
"System.IO.FileNotFoundException: Could not load file or assembly 'GSMCommShared, Version=1.21.0.0, Culture=neutral, PublicKeyToken=515d87df384dcc81' or one of its dependencies. The system cannot find the file specified. File name: 'GSMCommShared, Version=1.21.0.0, Culture=neutral, PublicKeyToken=515d87df384dcc81' at GsmComm.GsmCommunication.GsmPhone.Open() at GsmComm.GsmCommunication.GsmCommMain.Open() at BRUR.Sms.A.btnSend_Click(Object sender, EventArgs e) in d:\@Projects\BRUR\BRUR\Sms\smsSending.aspx.cs:line 42 WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Thanks in advance.
Posted

The error message is quite explicit:
System.IO.FileNotFoundException: Could not load file or assembly 'GSMCommShared, Version=1.21.0.0, Culture=neutral, PublicKeyToken=515d87df384dcc81' or one of its dependencies. The system cannot find the file specified.
It would appear that you have not included the DLL in your server installation.

I assume you realize that this will only work if the phone is plugged into the server, not the client? Because you'd be surprised how many people don't think about that...
 
Share this answer
 
Comments
Member 8454009 21-Jul-13 2:45am    
Of-course I add two reference in my bin folder.
using GsmComm.GsmCommunication;
using GsmComm.PduConverter;
Matej Hlatky 21-Jul-13 3:16am    
Oooh my..
The error is pretty self explanatory - the assembly GSMCommShared was not found.
You have to make sure, that GSMCommShared.dll file is either in GAC or in your webapp bin folder.
You have to set "Copy Local" property to True on your assembly reference.
 
Share this answer
 
Comments
Member 8454009 21-Jul-13 3:01am    
is there need to add GSMCommShared.dll. I don't use this in my C# code.
Member 8454009 21-Jul-13 3:03am    
Is there need to add GSMCommShared.dll in reference node.
I don't use this in my C# code but that was no problem.
Member 8454009 21-Jul-13 3:22am    
thank u very much, your think is correct. There is also need to be add reference GSMCommShared.dll. But still I dont't clear that why this reference was not need in C#.
OriginalGriff 21-Jul-13 3:46am    
It is: but the reference to the "shared" dll is not in your code, because your code does not directly reference it. The reference is in the GsmCommunication.Dll, because that is where the shared code is called from.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900