locked
MS CRM Website issue RRS feed

  • Question

  • I have been going mad/crazy over this and think I found the problem but no idea how to resolve this or why it happens.

     

    I have a DataGrid (ASP.NET 1.1) which binds to a custom datasource on the click of a button. That works.

     

    Now, when I add a button to say, the footer of that grid, give it a command name, create the appropriate eventhandlers (OnItemCommand etc....) and when i press that button - the command does not fire at all (the event). It posts back to the server but then the grid is lost - no data in the grid.

     

    I started a new project and tested it in that (not embedding it within MS CRM IFRAME) and it worked fine.

     

    Now, if I run this application in VS.NET 2003 or in a webbrowser and press that button, the itemcommand event fires correctly!

     

    Whats happening here? Why is the IFrame (or whatever else) preventing it from executing the event correctly?

     

     

    Wednesday, July 11, 2007 11:18 AM

Answers

  • I think your problem is with web.config, as the CRM web.config changes some default settings which you are not resetting in your web.config. The most likely setting you need to add to your web.config (within the <system.web> element is:

     

    <pages enableViewState="true" enableSessionState="true"/>

    Thursday, July 12, 2007 9:45 AM
    Moderator

All replies

  • Does it work?

    In the form OnSave() event, add:

    document.frames("IFRAME_test").document.getElementById("Button1").click();

    It should call the Button1.click() event on your asp.net page.

    P.S.
    1. check the Security settings (cross-frame) of IFRAME
    2. check IIS application pool settings (user) of your asp.net page.
    Wednesday, July 11, 2007 12:33 PM
    Moderator
  • the problem seems to be in IIS in the MS CRM Website.

    If i run this under a different website, it works perfectly but we want to deploy the solution within the VDir of MS CRM wanting all this to work fine without any real configuration/tinkering.

     

    the IIS pool settings for the VDir in MS CRM for my application is set to "Default pool". I have no idea why the MS CRM site would act differentely compared to a standard site, aside from the app pool and port settings.

     

     

    Wednesday, July 11, 2007 1:52 PM
  • In that case, I suggest you create a new app pool (don't use the default app pool)for your application.
    Wednesday, July 11, 2007 2:14 PM
    Moderator
  • I tried this, and this did not work at all. Perhaps the parent is forcing the child to use its pool?

    Wednesday, July 11, 2007 2:23 PM
  • No, it doesn't. You may select your own app pool for Virtual Directory.
    Have you check your application web.config ?

    Wednesday, July 11, 2007 2:32 PM
    Moderator
  • well the web.config is just a standard web.config. Here is a test I did and I need to resolve the problem

     

    created a NEW website. Set the port to 5554. Select the Default App Pool. Application works

    Changed app pool to the new pool I created, application works.

    Changed app pool to the CRMPool - application works!

     

    Change the pool in the MSCRM website to the default pool and also the new pool, application still fails to work correctly.

    Changed the pool back to MSCRM pool in the MSCRM website, application still fails.

     

     

    this is my web.config for the application:

     



    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <appSettings>
            <add key="MSCRMSdk" value="MSCRMServices/2006/CrmService.asmx" />
            <add key="MSCRMMetaDataSdk" value="MSCRMServices/2006/MetaDataService.asmx" />
    </appSettings>
      <system.web>
        <!--  DYNAMIC DEBUG COMPILATION
              Set compilation debug="true" to enable ASPX debugging.  Otherwise, setting this value to
              false will improve runtime performance of this application.
              Set compilation debug="true" to insert debugging symbols (.pdb information)
              into the compiled page. Because this creates a larger file that executes
              more slowly, you should set this value to true only when debugging and to
              false at all other times. For more information, refer to the documentation about
              debugging ASP.NET files.
        -->
       
        <compilation
             defaultLanguage="c#"
             debug="true">
            
             <assemblies>
       <remove assembly="Microsoft.Crm.MetadataService, Version=3.0.5300.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <remove assembly="Microsoft.Crm.Tools.ImportExportPublish, Version=3.0.5300.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </assemblies>
            
             </compilation>
       
        <!--  CUSTOM ERROR MESSAGES
              Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
              Add <error> tags for each of the errors you want to handle.
              "On" Always display custom (friendly) messages.
              "Off" Always display detailed ASP.NET error information.
              "RemoteOnly" Display custom (friendly) messages only to users not running
               on the local Web server. This setting is recommended for security purposes, so
               that you do not display application detail information to remote clients.
        -->
        <customErrors
        mode="Off"
        />
        <!--  AUTHENTICATION
              This section sets the authentication policies of the application. Possible modes are "Windows",
              "Forms", "Passport" and "None"
              "None" No authentication is performed.
              "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
               its settings for the application. Anonymous access must be disabled in IIS.
              "Forms" You provide a custom form (Web page) for users to enter their credentials, and then
               you authenticate them in your application. A user credential token is stored in a cookie.
              "Passport" Authentication is performed via a centralized authentication service provided
               by Microsoft that offers a single logon and core profile services for member sites.
        -->
        <authentication mode="Windows" />
     <!--  AUTHORIZATION
              This section sets the authorization policies of the application. You can allow or deny access
              to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
              (unauthenticated) users.
        -->
        <authorization>
            <allow users="*" /> <!-- Allow all users -->
                <!--  <allow     users="[comma separated list of users]"
                                 roles="[comma separated list of roles]"/>
                      <deny      users="[comma separated list of users]"
                                 roles="[comma separated list of roles]"/>
                -->
        </authorization>
        <!--  APPLICATION-LEVEL TRACE LOGGING
              Application-level tracing enables trace log output for every page within an application.
              Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the
              trace information will be displayed at the bottom of each page.  Otherwise, you can view the
              application trace log by browsing the "trace.axd" page from your web application
              root.
        -->
        <trace
            enabled="false"
            requestLimit="10"
            pageOutput="false"
            traceMode="SortByTime"
      localOnly="true"
        />
        <!--  SESSION STATE SETTINGS
              By default ASP.NET uses cookies to identify which requests belong to a particular session.
              If cookies are not available, a session can be tracked by adding a session identifier to the URL.
              To disable cookies, set sessionState cookieless="true".
        -->
        <sessionState
                mode="InProc"
                stateConnectionString="tcpip=127.0.0.1:42424"
                sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
                cookieless="false"
                timeout="20"
        />
        <!--  GLOBALIZATION
              This section sets the globalization settings of the application.
        -->
        <globalization
                requestEncoding="utf-8"
                responseEncoding="utf-8"
       />
      
     </system.web>
     
    </configuration>

     

     

     

     

    I don't understand whats going on. Why is this working correctly with a NEW website and using the CRMPool? But it fails to work using the MSCRM website?

    Wednesday, July 11, 2007 2:36 PM
  • Hi ahmedilyas,

    When you created a new website, which folder you selected? (under CRM web folder or somewhere else?) It's maybe a folder permission problem.
    Wednesday, July 11, 2007 2:56 PM
    Moderator
  • I wouldnt understand why it would be a permission problem? It makes no sense. The problem is that if I have a DataGrid in ASP.NET, when I have a commandName/ItemCommand event in place, it will not fire but postback and you loose the state of the grid/page.

    If however I run this same application in a new browser window or run it on a different WebSite, it works fine. How is that a permission issue? (just curious).

     

    I selected the folder in CRM Web folder and created a new virtual directory, pointing to the application.

    Wednesday, July 11, 2007 3:15 PM
  • Sorry for the misunderstanding. I thought it doesn't working under CRM website.

    If it's not permission problem, you may check the code. As far as I know, GridView(VS2005) works ok for me, not sure about DataGrid in your case. Please let us know how you fix it.
    Wednesday, July 11, 2007 3:35 PM
    Moderator
  • thanks. the code is fine, nothing wrong with the code. it all comes down to the IIS MS CRM Website. And now for some reason, I cannot use the webservice! I can access it but when i try to use it, it doesn't work (get a soap exception) but everything was working fine 40 mins ago....and ive not even modified the code.

    I really need help with this issue as we are a MS Partner and wish to develop this solution, as an ISV and deploy it

    Wednesday, July 11, 2007 3:40 PM
  • If it'a environment issue, how about if you test it on another clean CRM VPC?
    Wednesday, July 11, 2007 3:53 PM
    Moderator
  • could do however its just the time thing plus running CRM on a VPC....ouch! The dev machines I have are not great in terms of performance - Celeron with 1GB of RAM.....
    Wednesday, July 11, 2007 6:25 PM
  • I think your problem is with web.config, as the CRM web.config changes some default settings which you are not resetting in your web.config. The most likely setting you need to add to your web.config (within the <system.web> element is:

     

    <pages enableViewState="true" enableSessionState="true"/>

    Thursday, July 12, 2007 9:45 AM
    Moderator
  • LOL you won't believe it, but that was it. I changed that first things this morning just before reading your response now and it works fine.

     

    Spent 6 hours trying to figure it out, then trying to build another test environment last night, which took me into the late hours of the morning (around 5am) and didnt have much time to teset it. But yes that seemed to work and I have only had 2 hours sleep

     

    Any downside of this for MS CRM itself?

     

    Thanks David, much appreciated!

    Thursday, July 12, 2007 11:46 AM
  • Nice post! Cheers David!
    Thursday, July 12, 2007 12:03 PM
    Moderator
  • No downside with CRM, as long as you only modify the web.config in your own virtaul directory, and don't change the settings in the CRM web.config
    Thursday, July 12, 2007 12:33 PM
    Moderator