locked
IFD Authentication in Custom ASPX pages RRS feed

  • Question

  • I am currenlty writing some custom aspx pages to use in iframes & custom dialogs for our customization of CRM 4.

    After reading one article https://community.dynamics.com/blogs/cscrmblog/archive/2008/06/23/web-services-amp-dlls-or-what-s-up-with-all-the-duplicate-classes.aspx I decided to use the crm web service explicit methods (Retrieve, RetrieveMultiple etc..) as opposed to the crm sdk execute method for the data access to system and custom entities.

    We will be hosting our application using IFD authentication.  I found what appeared to be a simple method of getting the logged on user authentication using CrmImpersonator class and ExtractCrmAuthenticationToken as described in an artcile by Philip Richardson http://www.philiprichardson.org/blog/post/Part-4-ASPNET-Applications-on-the-CRM-Server.aspx to authenticate the user.  Trouble is this uses the crm sdk service and the token type does not appear to be useable with the crm web service token type.

     

    I am pretty new to the CRM programming model so maybe I am missing something simple.

     

    Suppose my question is should I use the sdk assemblies or the web services in our custom aspx pages for access to system & custom entities.  If it is the web services how do I authenticate my web service calls when a user has signed in using IFD.

     

    Hope someone can help.

     

    Cheers

     

     

    Friday, July 4, 2008 1:52 PM

Answers

  • This is not the full answer to your question, but one thing to keep in mind when referencing custom aspx pages and applications is to add your aspx page to a virtual folder under the CRM web site.  That way, if you call the URL from the sitemap, ISV.config or iframes, you can just put the referential URL as opposed to the full URL.  For example, if you create a virtual directory called Photos under the CRM web site, instead of putting http://crmserver:5555/photos/page.aspx, you would just put /photos/page.aspx as the URL.  That way when somebody clicks the link from internal it will go to http://crmserver:5555/photos/page.aspx, and if somebody clicks it from the IFD URL, it will go to http://ifdurl:5555/photos/page.aspx.
    Sunday, July 6, 2008 4:36 AM
    Moderator
  • The ExtractCrmAuthenticationToken method can only be used with the sdk assemblies, and not the web services, so as far as I know you'll have to use the sdk assemblies if using IFD.

     

    If you already have a lot of code that uses the web services, you could try using the ExtractCrmAuthenticationToken method of the sdk assembly to get the CallerId and CrmTicket, then create a new token using the web services and set the CallerId and CrmTicket - it might work

    Monday, July 7, 2008 5:40 AM
    Moderator

All replies

  • This is not the full answer to your question, but one thing to keep in mind when referencing custom aspx pages and applications is to add your aspx page to a virtual folder under the CRM web site.  That way, if you call the URL from the sitemap, ISV.config or iframes, you can just put the referential URL as opposed to the full URL.  For example, if you create a virtual directory called Photos under the CRM web site, instead of putting http://crmserver:5555/photos/page.aspx, you would just put /photos/page.aspx as the URL.  That way when somebody clicks the link from internal it will go to http://crmserver:5555/photos/page.aspx, and if somebody clicks it from the IFD URL, it will go to http://ifdurl:5555/photos/page.aspx.
    Sunday, July 6, 2008 4:36 AM
    Moderator
  • The ExtractCrmAuthenticationToken method can only be used with the sdk assemblies, and not the web services, so as far as I know you'll have to use the sdk assemblies if using IFD.

     

    If you already have a lot of code that uses the web services, you could try using the ExtractCrmAuthenticationToken method of the sdk assembly to get the CallerId and CrmTicket, then create a new token using the web services and set the CallerId and CrmTicket - it might work

    Monday, July 7, 2008 5:40 AM
    Moderator
  • We dont really have any code as yet - just test code.  It just seems a shame you cant use the web service interfaces.

    I tried the method you suggested and this didnt seem to work for me.

    My assumption was that having signed in using IFD (via the signin.aspx page).  I could then rely on somthing in the http header to carry my authentication.  The core CRM application obviously has the ability to carry that authenticated user forward into subsequent pages & popups.  I just need to do the same for our custom IFRAME apsx pages & any custom aspx popups.  Having looked at some of the IFD examples in the SDK - the code is providing username & password - I don't really want to do this for each page, and where do I get this information from anyway?

     

    My scenario is this:

     

    A user logs onto our customised CRM using the IFD (signin.aspx) page. They then either access a crm page that has one of our custom aspx pages within an IFRAME on that form, or some event or menu item present a popup which is one of our customer aspx pages.

    Our aspx page then needs to access the CRM services to read/write data.  How do I do this using the currenlty signed in user credentials?  Any code example would be appreciated greatly.

     

    A side question - is it just the signin.aspx page that would need SSL on a public network or should we use SSL for the entire site for an IFD scenario?

     

    Cheers for any help you could offer.

     

    Ant

    Wednesday, July 9, 2008 11:36 AM