Redirecting from a COM ASP page to a .NET assembly

1 minute read time.

You may have a need to redirect from a custom page written using the COM ASP API to a .NET assembly.

I have written about redirecting from COM ASP page before in the article "Redirecting to an ASPX (ASP .NET) Page from a Classic COM ASP page"

The code below shows how a URL for the redirect can be created.

To demonstrate the redirection I have created a custompage and added it to the company tab. All the page does is redirect to the relationship tab in the same context.



"RelatedEntities.dll-RunREList"));
%>

The method CRM.URL() is passed the name of the dll and the name of the public method and generates the full URL that contains the current context.

e.g.

http://localhost/CRM/eware.dll/Do?SID=160709231433869 &Act=432 &Mode=1 &CLk=T &Key0=1 &Key1=28 &Key2=30 &Key4=28 &dotnetdll=RelatedEntities.dll &dotnetfunc=RunREList

An alternative way is to call the system action and append the variables that indicate the DLL and Method to use.



" &dotnetdll=RelatedEntities &dotnetfunc=RunREList");
%>

Note: The exact key values added to the generated URL will depend on the context from which the page is called.

But you can also add your own parameters to the URL



"RelatedEntities.dll-RunREList")+" &wibble=flange");
%>

These extra parameters will be added to the URL

e.g.

http://localhost/CRM/eware.dll/Do?SID=160709231433869 &Act=432 &Mode=1 &CLk=T &Key0=1 &Key1=28 &Key2=30 &Key4=28 &dotnetdll=RelatedEntities.dll &dotnetfunc=RunREList &wibble=flange

Within the .NET code the parameters can be read by the Dispatch.QueryField() or Dispatch.EitherField() methods.