Tuesday, 27 April 2010

Escaping javascript strings in Umbraco XSLT macros

How to escape string literals in XSLT which appear inside JavaScript function calls:-

<xsl:variable name="apos">'</xsl:variable>
<xsl:if test="data[@alias='popupMessage'] != ''">
      <xsl:attribute name="onclick">
        <xsl:text>return window.confirm('</xsl:text>
        <xsl:value-of select="umbraco.library:Replace(data[@alias='popupMessage'], $apos, concat('\',$apos))" disable-output-escaping="yes" />
        <xsl:text>');</xsl:text>
      </xsl:attribute>
</xsl:if>

Sunday, 25 April 2010

ASP.NET, hMailServer, error “The SMTP server requires a secure connection or the client was not authenticated” or “SMTP authentication is required”

If you receive the above error message when sending email via hMailServer’s SMTP Service, just go into the Admin console –> Settings/Advanced/IP Ranges/My Computer and uncheck the boxes below.

image

Windows Server 2008, IIS 7, Shared Configuration, System Corrupted Irrecoverably

The story is, I tried to copy IIS7 configuration from one Windows Server 2008 server to another. 

  • This overwrote the applicationHost.config
  • IIS/App Pools failed because global modules that were on the previous server were not installed on the current
    • Attempted to install those modules
    • that failed.
  • Thought I’d try to rollback, but it doesn’t backup the original IIS7 config
  • Uninstalled IIS7
    • Tried to reinstall IIS7
    • That failed
  • Tried to set up Windows Installer tracing with special registry entries
    • Tracing doesn’t work, no file is output into the %Temp% directory
  • Now wanting to do a system restore
    • There’s no system restore on Windows Server 2008

Quite a disproportional dilemma given the cause.

I like Microsoft – sometimes.  But really, I have had problems with Windows Server set up before… they haven’t put the effort into making this work.  And given that it’s usually professionals who are working setting up boxes, it would be a good idea to give some error messages that mean something.

Tuesday, 13 April 2010

Message: Type 'umbraco.DataLayer.SqlHelperException' in Assembly 'umbraco.DataLayer, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

This is most likely because the database is inaccessible to Umbraco.  Check the connection strings are correct and also try connecting using the same connection string credentials with SQL Management Studio.