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

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

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

  • Comments 2
  • Likes

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.


<!-- #include file ="sagecrm.js"-->
<%
Response.Redirect(CRM.URL("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.

Comments
  • I hope you don't mind me mentioning Jeff that 'CRM Togethers' product 'Titan ASP.Net for Sage CRM' allows you to create ASPX pages for Sage CRM without having to code SOAP and in fact allows you to build screens using drag and drop from visual studio. You can also build your own Sage CRM web services if you find the out of the box soap services too limiting.

  • Marc

    I certainly do not mind you saying that.  I rather expect that partners like yourself who have developed addons that extend Sage CRM's capabilities will chip in as these could be just what the customer needs.