0

In CRM 4.0 we could place dynamic content (aspx) in the ISV-folder in CRM, creating separate applications but with security and relative URLs to CRM, so for example a custom 360 view of account could be linked in an iframe using a relative URL along the lines of

/ISV/CrmMvcApp/Account.aspx/Overview?id=....

In CRM 2011 usage of the ISV folder is deprecated and Microsoft has some guidelines on how to transition into doing this in supported manner (MSDN gg309571: Upgrade Code in the ISV folder to Microsoft Dynamics CRM 2011). They say:

For scenarios that will not be satisfied by the Web resources feature, create your Web application in its own application pool with its own web.config.

The way I am reading this (coupled with the guidelines on supported/unsupported) is that we need a separate web site in IIS with its own binding as you are not allowed to add virtual directories etc. under the standard CRM app. This is unfortunate and does not allow relative paths/URLs in customizations and sitemap. This is troublesome especially when exporting and importing solutions from DEV, TEST and/or PROD.

  • Are my assumptions wrong?
  • Can we somehow have relative paths?
  • Have anyone else found a pragmatic and easy approach to having external content without doing the sitemap and customization changes for each environment?

EDIT: Confirmed with other sources that my understanding of the guidelines are correct, as this is also listed in the list of unsupported changes. Virtual folders and web apps are to be kept totally separated from the default CRM web site.

Creating an Internet Information Services (IIS) application inside the Microsoft Dynamics CRM website for any VDir and specifically within the ISV folder is not supported.

MSDN gg328350: Unsupported Customizations

4

3 回答 3

1

If you primarily need to access CRM data/records, take a look at using a jScript web resources. You can do "most" CRUD operations using the REST OData services. If you use JQuery to parse the JSON it's very productive.

于 2012-07-03T23:57:52.037 回答
1

I have found a solution much like the javascript redirect, without the need for client execution and only configuring the environment details (servername, port) once. Additional logic can easily be added.

The solution creates a dependency into the customizations, but not an environment one like and can be used for unmanaged and managed solutions.

The solution was to place a file Redirect.aspx in the ISV folder. The code does not in any way interact with CRM and falls within the supported guidelines, however the solution is not future proof as the ISV folder is deprecated by Microsoft.

Redirect.aspxwill automatically pass along any parameter passed, so will work with or without the entity identifiers and so on.

Usage:

  • Place the file in the ISV folder on the CRM app server
  • Change the server name and port to match the current environment (must be done for each environment)
  • In customizations, for example for an iframe, use the following as a source:

    /ISV/Redirect.aspx?redirect=http://SERVERREPLACE/CustomMvcApp/SomeControllerAction
    

Here is the content of Redirect.aspx

<%@ Page Language="C#" %>    
<html>
<script runat="server">
  protected override void OnLoad(EventArgs e)
  {
      // must be customized for each environment
      const string ServerBaseName = "appserver1:60001"; 
      const string UrlParameterName = "redirect";
      const string ReplacePattern = "SERVERREPLACE";

      var parameterUrl = Request.Params[UrlParameterName].Replace(ReplacePattern, ServerBaseName);

      var queryStringBuilder = new StringBuilder();

      foreach (var key in Request.QueryString.AllKeys)
      {
          if (key == UrlParameterName)
          {
              continue;
          }

          queryStringBuilder.Append(!(queryStringBuilder.Length > 0) ? "?" : "&");
          queryStringBuilder.Append(key + "=" + Request.QueryString[key]);
      }

      var completeRedirectString = parameterUrl + queryStringBuilder;

      Response.Redirect(completeRedirectString);
  }   
</script>
<head>
    <title>Redirecting</title>
</head>
</html>
于 2012-07-11T08:27:15.537 回答
0

Not quite "relative urls" as per your question, but a solution I use is to store "stub" or "root" urls in a config entity and read those records in JScript at runtime to determine the fully qualified destination for your custom links.

于 2012-07-02T11:42:09.973 回答