e-mail with forms.renderer

Topics: Troubleshooting
Feb 26, 2011 at 2:14 PM

Hi all,

I have a page with a function to send an email from this page. Just plain and simple a Name, an e-mailaddress, a question and a captha. I use in my web.config the following lines

<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="mail.jannesmulder.com" port="25" userName="username" password="Password" defaultCredentials="false" />
      </smtp>
    </mailSettings>
</system.net> 

but when i test it it gives me an error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Object reference not set to an instance of an object.

Source Error:


Line 184:  catch (Exception ex)
Line 185:  {
Line 186:   throw new InvalidOperationException(ex.Message);
Line 187:  }
Line 188: }

Source File: c:\inetpub\vhosts\jannesmulder.com\httpdocs\Frontend\Composite\Forms\Renderer\Controls\FormsRender.ascx.cs    Line: 186

Stack Trace:

[InvalidOperationException: Object reference not set to an instance of an object.]
   FormsRenderer_FormsRender.Send_Click(Object sender, EventArgs e) in c:\inetpub\vhosts\jannesmulder.com\httpdocs\Frontend\Composite\Forms\Renderer\Controls\FormsRender.ascx.cs:186
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

 --------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

 

The question is where to start how to solve this problem? I don't have a clue

grtz Ronald

Coordinator
Feb 26, 2011 at 2:28 PM

Hi Ronald

>> The question is where to start how to solve this problem?

Edit \Frontend\Composite\Forms\Renderer\Controls\FormsRender.ascx.cs, comment the "try" and "catch" keywords  in try {...} catch {...} block

Before:

try 

{

  ...

}

catch (Exception ex)
 {
    throw new InvalidOperationException(ex.Message); // Line 186
 }

After

// try 

{

  ...

}

/*catch (Exception ex)
 {
    throw new InvalidOperationException(ex.Message); // Line 186
 }*/

Try to use the form again, this time you'll see the code line that causes the problem (not line #186 in which the exception is rethrown)

Coordinator
Feb 26, 2011 at 2:29 PM

I guess we should fix that directly in the fature package code - the catch is only making things worse.

Feb 26, 2011 at 3:14 PM

tried that and now the error is the same but on line 163

Server Error in '/' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 161:        //try
Line 162:        //{
Line 163:        if (FormsRenderer.SubmitForm(parameters, CaptchaInput.Text))
Line 164:        {
Line 165:            string responseText = parameters.GetParameter<string>("ResponseText");
 

Source File: c:\inetpub\vhosts\jannesmulder.com\httpdocs\Frontend\Composite\Forms\Renderer\Controls\FormsRender.ascx.cs    Line: 163

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   Composite.C1Console.Forms.FormsRendererProperty.ToString() +355
   Composite.Forms.FormEmailHeader.get_Cc() +41
   Composite.Packages.FormsRenderer.FormsRenderer.SubmitForm(ParameterList parameters, String captchaText) +3945
   FormsRenderer_FormsRender.Send_Click(Object sender, EventArgs e) in c:\inetpub\vhosts\jannesmulder.com\httpdocs\Frontend\Composite\Forms\Renderer\Controls\FormsRender.ascx.cs:163
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

 thanks for the help already!

Coordinator
Feb 26, 2011 at 11:04 PM

Looks like something is wrong with the captcha part, can you try to turn it of and see whether it is working?

Feb 26, 2011 at 11:18 PM

ok tried that, but no difference. Still the same error as before.

 

Feb 26, 2011 at 11:30 PM

ok so I checked everything again and it appeared that the parameter value of the property name for the Cc I used had a typo!

as you can see in the stack trace where it goes wrong after the get_Cc

Composite.C1Console.Forms.FormsRendererProperty.ToString() +355
Composite.Forms.FormEmailHeader.get_Cc() +41

thanks for your help guys!