Calling a .NET DLL from another .NET assembly

You can use the UrlDotNet method to reference a .NET DLL from another .NET Assembly. The UrlDotNet method is exposed by the Web class in the Sage.CRM.WebObject namespace.

The UrlDotNetDll method has the following syntax:

UrlDotNet(<DllFileName>, <Method>);

Where:

  • <DllFileName>. Is the name of the .NET .dll file you want to reference. Make sure the .dll file is stored in the required location on the Sage CRM server. For more information, see Storage location for custom .NET DLLs.
  • <Method>. Is the method you want to call that is implemented in the .dll file.

Example:

string sUrl = UrlDotNet("MyDllFile.dll", "RunViewOpportunity");
AddUrlButton("Cancel", "Cancel.gif", sUrl);

Alternatively, you can use the Dispatch.Redirect method within another .NET DLL, for example:

Dispatch.Redirect(UrlDotNet(“MyDllFile.dll”, “RunDataPage”));

In this case, consider the following:

  • The.NET API redirect occurs only when the .NET .dll is finished processing the code, and it must provide the HTTP response before being unloaded from memory.
  • Use the Dispatch.Redirect method inside BuildContents only and return it after the redirect is set. Otherwise, system performance could be seriously impacted.
  • Only use one redirect in the code, and set the URL in any previous branches in the code.