Code + Form = Form Loads very slow - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Code + Form = Form Loads very slow

Last post 03-02-2012 11:16 AM by sirwally. 17 replies.
Page 1 of 2 (18 items) 1 2 Next >
Sort Posts: Previous Next
  • 01-20-2011 09:45 AM

    • BoZo86
    • Not Ranked
    • Joined on 01-20-2011
    • Posts 9

    Code + Form = Form Loads very slow

    Hello @all, i've got a problem with the with the performance of the Form. I created a Infopath Form ClientApp in Infopath 2007. There are several Dataconnections and webservices. It opened very fast, if i wanted to preview. After that, i added a simple C# code on Form_Load here: using Microsoft.Office.InfoPath;
    using System;
    using System.Windows.Forms;
    using System.Xml;
    using System.Xml.XPath;
    using mshtml;

    namespace _26ab543de70008acustomXsn
    {
    public partial class FormCode
    {
    // Member variables are not supported in browser-enabled forms.
    // Instead, write and read these values from the FormState
    // dictionary using code such as the following:
    //
    // private object _memberVariable
    // {
    // get
    // {
    // return FormState["_memberVariable"];
    // }
    // set
    // {
    // FormState["_memberVariable"] = value;
    // }
    // }

    // NOTE: The following procedure is required by Microsoft Office InfoPath.
    // It can be modified using Microsoft Office InfoPath.
    public void InternalStartup()
    {
    EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);
    }

    public void FormEvents_Loading(object sender, LoadingEventArgs e)
    {
    XPathNavigator xNavRoot = this.CreateNavigator();
    //XPathNavigator xNavUserDomain = xNavRoot.SelectSingleNode("dfs:myFields/dfs:queryFields/tns:GetUserOffice/tns:strUser", this.NamespaceManager);
    XPathNavigator xNavUserDomain = xNavRoot.SelectSingleNode("pr:properties/p:properties/documentManagement/ns1:DHSAuthorOrOwner/ns1:UserInfo/ns1:DisplayName", this.NamespaceManager);
    string UserDomain;
    UserDomain = System.Environment.UserDomainName + "\\" + System.Environment.UserName;
    xNavUserDomain.SetValue(UserDomain);

    // Write your code here.
    }
    }
    }


    Now it takes approx. 1 minute to load the Form. What can be the problem? Do i have to configurate something else? Regards, Bozo86
  • 01-20-2011 10:20 AM In reply to

    Re: Code + Form = Form Loads very slow

    Hi, do you want to use browser form or rich client form?

    To see if it's the code is the problem can you remove this line and tell us if ithe form load slowly :

     UserDomain = System.Environment.UserDomainName + "\\" + System.Environment.UserName;

  • 01-20-2011 01:16 PM In reply to

    • BoZo86
    • Not Ranked
    • Joined on 01-20-2011
    • Posts 9

    Re: Code + Form = Form Loads very slow

    hi, i want to use it with rich client.

    I have deleted this line: UserDomain = System.Environment.UserDomainName + "\\" + System.Environment.UserName;
    Nothing has been changed. I think the problem is, that a C# Project is included in the form.
  • 01-20-2011 01:29 PM In reply to

    Re: Code + Form = Form Loads very slow

    Hi, your C# project is not so big and when a client load your form he just load a Dll include on your form template. Can you make a copy of the code and remove the code from "form options", "programming".

    And tell us if your form load quickly ?

  • 01-20-2011 01:32 PM In reply to

    • BoZo86
    • Not Ranked
    • Joined on 01-20-2011
    • Posts 9

    Re: Code + Form = Form Loads very slow

    Right potemkine, I've removed the Code and it works fast.

    But how can I use the Code and run it fast?
  • 01-20-2011 01:40 PM In reply to

    Re: Code + Form = Form Loads very slow

    It sounds a little weird ! Can you try this :

    try to create a code project, load VSTA (don't put any code) and tell us how fast it is?

    try to do the same but on another computer if it's possible.

  • 01-20-2011 01:59 PM In reply to

    • BoZo86
    • Not Ranked
    • Joined on 01-20-2011
    • Posts 9

    Re: Code + Form = Form Loads very slow

    The same... It doesn't matter if you delete the code. It is enough to have a C# Project. It takes again so much time

    Now I'm uninstalling Office 2007 Professional Plus and will re-install it.
  • 01-20-2011 02:48 PM In reply to

    • BoZo86
    • Not Ranked
    • Joined on 01-20-2011
    • Posts 9

    Re: Code + Form = Form Loads very slow

    I tried it with new installed Office 2007 Professional Plus, it is the same. :((
    I took every code out and pasted in again but it is the same result...
  • 01-20-2011 06:31 PM In reply to

    Re: Code + Form = Form Loads very slow

    And if you try to design a brand new form with code ?
  • 01-21-2011 05:47 AM In reply to

    • BoZo86
    • Not Ranked
    • Joined on 01-20-2011
    • Posts 9

    Re: Code + Form = Form Loads very slow

    I found the problem. The Client tries to check the CRL (Certificate Revocation List) so it will take a long time.

    To disable this:
    Internet Setting --> Advanced --> Check for publisher's certificate revocation (DISABLE)

    After that, it will not check for any certificates. But here i've got a question, my Code wants to take information from the Computer (Domain\Username), so i think it will need a certificate to execude it on other workstations? Do I need a workaround for this?
  • 01-21-2011 07:07 AM In reply to

    Re: Code + Form = Form Loads very slow

    Hi, have you sign your form yourself and what kind of certificate do you use?

    if you use a valid code signing certificate deliver for instance by a domain certificate server the .NET CLR loads a code-signed assembly and will be able to reach the

    CRL distribution point and your form will load quickly on the domain.

  • 01-25-2011 04:20 AM In reply to

    • BoZo86
    • Not Ranked
    • Joined on 01-20-2011
    • Posts 9

    Re: Code + Form = Form Loads very slow

    hi Potemkine, i know only to create the own certificate. How can i take or create a global certificate that it can be used for every workstation?
  • 01-25-2011 05:26 AM In reply to

    Re: Code + Form = Form Loads very slow

    Hi, normally you can use this kind of certificate. Can you verify that your certificate is on trusted root certification authorities group?

    http://kbalertz.com/867441/error-occur-signed-solutions-using-method-Office-InfoPath-Service.aspx

  • 01-25-2011 09:38 AM In reply to

    • BoZo86
    • Not Ranked
    • Joined on 01-20-2011
    • Posts 9

    Re: Code + Form = Form Loads very slow

    hmm.. my problem is, i am developing on a developer client. The certificate uses my information. But the certifcate must be taken to the server, where the applications should be stored and run from there in other clients. Should i install the certificate only on the server or should i roll-out it via AD on every Client?
  • 01-25-2011 07:46 PM In reply to

    Re: Code + Form = Form Loads very slow

    Hi, the client will be able to use the certificate you've create with Infopath out of box code signing and if they install it the message will not be prompt anymore. Infopath out of box code signing certificate doesn’t allow the certificate’s private key to be exported it means that only the user who create the certificate can use it. In your case it's not a problem.

    I already develop form on this kind of setup and I didn't have any certificate issue.

Page 1 of 2 (18 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.