locked
Using ASP.Net Ajax Extensions in custom aspx pages in MS CRM 4.0 offline mode RRS feed

  • Question

  •  

    Hi,

     

    I am trying to get an AJAX enabled webpage to work within the CRM Offline client but keep getting the client side error: 'Sys is undefined'.
    The web page is deployed in the Offline ISV folder …

    So far I have tried:
    - Added the necessary AJAX information to CRMs web.config as well as to the web.config file of my application.
    - Disabling script compression
    It looks like the AJAX script resources could not being loaded when the site is hosted in the MS CRM cassini environment.
    If I’m using a separate cassini instance to host my web page it’s working fine. 
    But in that case the cassini application directory points to the root folder of my web application.
    If I’m hosting the web application online within the CRM environment all is working fine.
    Has anyone gotten AJAX to work with the Offline client with pages deployed in the ISV folder?
    Tuesday, April 15, 2008 12:29 PM

Answers

  • Tofri,

    It might be the virtual path issue, check the path of the web page when go offline.

     

    Cheers,

    Jim

     

    Wednesday, April 16, 2008 10:42 AM
    Moderator

All replies

  • Tofri,

    It might be the virtual path issue, check the path of the web page when go offline.

     

    Cheers,

    Jim

     

    Wednesday, April 16, 2008 10:42 AM
    Moderator
  •  

    Jim,

     

    The problem is that cassini tries to load the embedded java script resources from a wrong path.

     

    If I'm running fiddler I see the following:

    A generated script line running with Cassini has:
    script src="/WebResource.axd?

    But it should be:
    script src="ISV/WebProject/WebResource.axd?

     

    That's why I get a 404 error for the script resource files and this brings me to the "Sys is undefined" error.

     

    The Microsoft.Crm.ApplicationHoster.exe is running under the ...\res\web application directory
    and the virtual directory is pointed to "/".

     

    I've no idea how to tell cassini that he should load the embedded script resources from my application directory.
    I've also copied all the AJAX stuff to the res\web\bin directory but this also doesn't helps.

     

    Cheers,
    Torsten

    Thursday, April 17, 2008 9:38 AM
  • Hi All,
    Is anybody able to fix this issue.
    Please let me know , i stuck at this point and has wasted too much time.
    Any reply would be appreciated.

    Thanks
    Wednesday, March 18, 2009 5:51 AM
  • I got the AJAX extensions working by doing the following:

    1) Install the appropriate AJAX extensions on you client machine

    2) Add this to your httpHandlers in the CRM web.config (in \res\web - so this is unsupported since you shouldn't modify that file )

    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>

    3) then add 2 empty text files called ScriptResource.axd and WebResource.axd to the \res\web folder and things should work. (I found this courtesy of an old mailing list discussion - credit for this discovery to Søren Busch-Knudsen )

    HOWEVER, I am still looking for a way to avoid modifying the CRM web.config. I've everything I can think of, but can't seem to find anything that works. If anybody has any suggestions at all, they would be much appreciated!

    Thanks,
    Simon
    • Proposed as answer by HTan Friday, August 7, 2009 3:35 PM
    Thursday, April 2, 2009 8:30 PM
  • Hey Simon-N - Thanks for the hint on # 3.  I had issue with rendering Treeview image on Cassini.   I'm glad that it turns out to be a simple missing WebResource.axd file and not something to do with with web.config.
    HT
    Friday, August 7, 2009 3:35 PM
  • Hi Simon.
    Thanks for the solution, it worked for me. I was missing point 3.

    Regards,
    Ale
    Dynamics CRM Consultant
    Monday, August 10, 2009 3:14 PM