Input string was not in a correct format.

This is an open forum for any mojoPortal topics that don't fall into the other categories.

This thread is closed to new posts. You must sign in to post in the forums.
5/5/2012 5:49:22 PM
Gravatar
Total Posts 59

Input string was not in a correct format.

I have an issue posting in a forum page on my website. If I run the website from source code in Visual Studio 2010 on my local machine, I create new topics and post without any problems. If I try a test topic with anything in subject and text it throws this error. There are no illegal chars going in, I've tried a few different topics, the last being test for the subject and test for the text.

Mojoportal version: 2.3.8.1 MSSQL

Operating System Microsoft Windows NT 6.0.6002 Service Pack 2

Forum version: 0.0.2.1

Error:

Server Error in '/' Application

Input string was not in a correct format

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FormatException: Input string was not in a correct format.] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +9586043 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119 System.Byte.Parse(String s, NumberStyles style, NumberFormatInfo info) +35 System.Convert.ToByte(String value, IFormatProvider provider) +48 mojoPortal.Web.Framework.CryptoHelper.StringToByteArray(String inputText) +222 mojoPortal.Web.Framework.CryptoHelper.Decrypt(String encryptedText) +356 mojoPortal.Web.SiteUtils.GetSmtpSettings() +399 mojoPortal.Web.ForumUI.ForumPostEdit.GetSmtpSettings() +339 mojoPortal.Web.ForumUI.ForumPostEdit.btnUpdate_Click(Object sender, EventArgs e) +5770 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) +176 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.233



5/6/2012 9:30:13 AM
Gravatar
Total Posts 18439

Re: Input string was not in a correct format.

If you look at the error detail it is not from the forum but from trying to get the smtp settings to sned forum notification after making a post. It is trying to get the smtp from site settings instead of web.config and it is failing where it is trying to decrypt the data. You may need to go into site settings and reset the smtp info and save.

Hope that helps,

Joe

5/6/2012 12:14:49 PM
Gravatar
Total Posts 59

Re: Input string was not in a correct format.

What's the difference between the config email settings and the site email settings? I saw the site email settings and did wonder.

Thanks,

Andrew

5/7/2012 7:21:53 AM
Gravatar
Total Posts 18439

Re: Input string was not in a correct format.

By default we don't use site settings we use user.config settings for smtp.

The only reason yours is using smtp settings from site settings is becuase you set this to true:

<add key="EnableSiteSettingsSmtpSettings" value="true" />

With that set to the default of false smtp settings are used from user.config

The only real advantage of using smtp from site settings is if you have a multi site installation and need to use different smtp settings per site or you just prefer to set those from the UI instead of from user.config.

See also Email Configuration

Hope that helps,

Joe

5/7/2012 9:34:49 AM
Gravatar
Total Posts 59

Re: Input string was not in a correct format.

It was exactly that. I've set this to false now and I no longer see this exception. I'll stick to using the web config for email settings I think.

Cheers

Andrew

You must sign in to post in the forums. This thread is closed to new posts.