Redirecting to an ASPX (ASP .NET) Page from a Classic COM ASP page

1 minute read time.

This article follows on from an earlier article "Combining CRM WebServices and ASP.NET".

That article had discussed using the SOAP based webservices of Sage CRM within an ASP.NET page. I had mentioned that such ASPX pages can be called from Sage CRM tabs (and by extension Button Groups) using the customfile system action and that you can also redirect to an ASPX page from within a classic ASP page.

The aim of the redirect would be to allow a developer to use the features of ASP.NET and use the data from Sage CRM using the SOAP web services which in turn would use the Session ID of the main interface. You will need to read that earlier article to understand how the session id can be shared.

I mentioned the Redirect technique in passing so to be explict, here is some example code.

This code shows how a classic COM ASP page could redirect to an ASPX page.



"test.aspx"));
%>

Note: I tested this by calling the page from the Company context. The COM method CRM.URL() has been used to add the contextual information and current Session ID to the url for the ASPX page.

The page redirected and the final URL for the test.aspx page was

http://servername/installname/CustomPages/test.aspx?SID=111500810432639 &Key0=1 &Key1=28 &Key2=30 &F=redirectaspx.asp &J=test.aspx

The Session ID is available to the ASPX page via the QueryString and the information about company and person context is provided by the Key0 and Key1 name/value pairs.