varunmaggo's say

Getting better never stops!

Archive for the ‘CMS’ Category

How to relay mail through Gmail

leave a comment »

If you don’t have an smtp server available on your hosting machine, you can use your Gmail account to relay your mail.
The disadvantage of doing this is that the “from” address will always be your Gmail account’s address.

When you create content item, you have an optional checkbox “Mailserver SSL on”. We need SSL for Gmail, so set this checkbox to true.

In your web.config, use these settings:

 <system.net>
    <mailSettings>
      <smtp>
        <network 
                        host="smtp.gmail.com" 
                        port="587"
                        userName="yourGmailAccount" 
                        password="yourGmailPassword" 
                        defaultCredentials="false"
                />
      </smtp>
    </mailSettings>
  </system.net>

Written by Varun Maggo

March 1, 2011 at 5:34 am

Posted in ASP.NET, CMS

Umbraco 4.5.2 – Cannot insert the value NULL into column ‘id’, table ‘adsel-website.dbo.cmsPropertyData’; column does not allow nulls. INSERT fails.

leave a comment »

Error : Cannot insert the value NULL into column ‘id’, table ‘adsel-website.dbo.cmsPropertyData’; column does not allow nulls. INSERT fails.

Stack Trace: [SqlException (0x80131904): Cannot insert the value NULL into column 'id', table 'adsel-website.dbo.cmsPropertyData'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +204
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +175
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) +56
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) +83
umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteNonQuery(String commandText, SqlParameter[] parameters) in d:\inetpub\wwwroot\ccnet\Source\Umbraco 4\umbraco\datalayer\SqlHelpers\SqlServer\SqlServerHelper.cs:64
umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) in d:\inetpub\wwwroot\ccnet\Source\Umbraco 4\umbraco\datalayer\SqlHelper.cs:217

[SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteNonQuery]
umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) in d:\inetpub\wwwroot\ccnet\Source\Umbraco 4\umbraco\datalayer\SqlHelper.cs:221
umbraco.cms.businesslogic.property.Property.MakeNew(PropertyType pt, Content c, Guid versionId) +247
umbraco.cms.businesslogic.Content.createNewVersion() +355
umbraco.cms.businesslogic.web.Document.PublishWithResult(User u) +134
umbraco.cms.presentation.editContent.Publish(Object sender, EventArgs e) +178
System.EventHandler.Invoke(Object sender, EventArgs e) +0
umbraco.controls.ContentControl.savePublish(Object Sender, ImageClickEventArgs e) +46
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.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) +1565

Solution : The table definition on the local db would have
Code:

[id] [int] IDENTITY(1,1) NOT NULL,

and on the host would have
Code:

[id] [int] NOT NULL,

The create script is: \source\umbraco\datalayer\SqlHelpers\SqlServer\Sql\Total.sql

Written by Varun Maggo

February 21, 2011 at 1:43 pm

Posted in CMS

Follow

Get every new post delivered to your Inbox.