Often we encounter issue where Sitecore Link in RTE is presented in GUID instead its SEO friendly URL. Sitecore by default do render Sitecore Link in RTE in GUID, this is so as to allow movement of the targeted item within the content tree without the need to change the RTE itself. Fortunately Sitecore OOB also support the functionality to convert this GUID link to its SEO friendly URL.
There are two ways to achieve this,
1. Using sc:html instead for example sc:text
2. Using the following code global::Sitecore.Links.LinkManager.ExpandDynamicLinks(value, true);
I personally prefer the first approach whenever possible just because it involves the least amount of coding work.
Tuesday, October 25, 2011
Monday, October 17, 2011
Microsoft SQL Server Error 18456 Severity 14 State 1
Just then, i have encountered a puzzling error about a newly created login user that I have just created in database. For some odd reason, i keep getting login error even though i have checked that both username and password is correct.
It turned out that the SQL Server is not setup properly. The security setup in SQL server was set to "windows authentication" only where it is supposed to be both "SQL and Windows authentication".
to enable this, right click the SQL Server, click properties, under security tab you will see the radio button. Select "SQL Server and Windows Authentication mode"
Remember to restart the SQL Server as the changes will not take effect before a reboot. To reboot, right click SQL Server -> Restart
It turned out that the SQL Server is not setup properly. The security setup in SQL server was set to "windows authentication" only where it is supposed to be both "SQL and Windows authentication".
to enable this, right click the SQL Server, click properties, under security tab you will see the radio button. Select "SQL Server and Windows Authentication mode"
Remember to restart the SQL Server as the changes will not take effect before a reboot. To reboot, right click SQL Server -> Restart
Tuesday, August 2, 2011
Custom error for arbitrary extension
Recently I need to present a custom error for webpages with arbitrary extension.
e.g. http://domain/test.blah
Normally it will just present you with a default error message just like the one below
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search for the words HTTP and 404.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Web Site Setup, Common Administrative Tasks, and About Custom Error Messages.
we want to capture this error and present them with our custom not found page. This requirement is useful if you want to track how many not found page users encounter.
to achieve this the following is entered in the web.config
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://www.visitvictoria.com/not-found.aspx" responseMode="Redirect" />
</httpErrors>
just before
</system.webserver>
e.g. http://domain/test.blah
Normally it will just present you with a default error message just like the one below
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search for the words HTTP and 404.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Web Site Setup, Common Administrative Tasks, and About Custom Error Messages.
we want to capture this error and present them with our custom not found page. This requirement is useful if you want to track how many not found page users encounter.
to achieve this the following is entered in the web.config
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://www.visitvictoria.com/not-found.aspx" responseMode="Redirect" />
</httpErrors>
just before
</system.webserver>
Tuesday, July 12, 2011
Clicking "Lock and Edit" throws Item archive error has occured
Recently i have been baffled to figure out why clicking "lock and edit" throws an "Item Archive error has occured: Object reference not set to an instance of an object"
The problem is because of the Security setup. Now the Sitecore Tree setup which we inherit from another company is quite messy. Here is the structure
Sitecore
--> Content
--> Home (aka main website)
--> Page 1
--> Mini Website
--> Page 1
--> Another Mini Website
We have a requirement whereby a user let's called him user1 is allowed only to look at "Mini Website". Of course the approach is to use default Sitecore Security feature. Ideally when user1 is logged in the Sitecore tree should look like below
Sitecore
--> Content
--> Mini Website
--> Page 1
That's the cause of the error. Basically Sitecore->Content->Home need to be available.
So the Tree setup turn out to be
Sitecore
--> Content
--> Home
--> Mini Website
--> Page 1
The problem is because of the Security setup. Now the Sitecore Tree setup which we inherit from another company is quite messy. Here is the structure
Sitecore
--> Content
--> Home (aka main website)
--> Page 1
--> Mini Website
--> Page 1
--> Another Mini Website
We have a requirement whereby a user let's called him user1 is allowed only to look at "Mini Website". Of course the approach is to use default Sitecore Security feature. Ideally when user1 is logged in the Sitecore tree should look like below
Sitecore
--> Content
--> Mini Website
--> Page 1
That's the cause of the error. Basically Sitecore->Content->Home need to be available.
So the Tree setup turn out to be
Sitecore
--> Content
--> Home
--> Mini Website
--> Page 1
Friday, July 8, 2011
Script to Deploy Files to Delivery
@ECHO OFF
SETLOCAL
::******************************************* Constants / ROBOCOPY Settings ***********************************************************
SET _what=/COPYALL /E
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree
:: /E :: Copy Subfolders, including Empty Subfolders.
SET _options=/R:0 /W:0 /TS /FP /IS
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging
:: /IS :: Include Same, overwrite files even if they are already the same. Use this options if you want to overwrite
:: /XO :: eXclude Older - if destination file exists and is the same date or newer than the source - don't bother to overwrite it.
SET _timestamp=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%%TIME:~0,2%%TIME:~3,2%
:: This will create a timestamp like yyyymmyyhhmm.
SET _source="X:\source\Deployment\Deploy Me"
:: Source of the files to copy from
::*************************************** End of Constants / ROBOCOPY Settings ********************************************************
:: Delivery 1
SET _dev1="\\delivery1\c$\inetpub\dev.website.com\Website"
SEt _dev1log="X:\delivery1\Deployment\Deployment Logs\APP01"\%_timestamp%.txt
Echo Synchronising Delivery Server 1 with CMS Server
ROBOCOPY %_source% %_dev1% %_what% %_options% /LOG:%_dev1log%
Echo Synchronising to Delivery Server 1 has been completed!
:: End of Delivery 1
Echo.
:: Delivery 2
SET _dev2="\\delivery2\c$\inetpub\dev.website.com\Website"
SEt _dev2log="X:\delivery2\Deployment\Deployment Logs\APP02"\%_timestamp%.txt
Echo Synchronising Delivery Server 2 with CMS Server
ROBOCOPY %_source% %_dev2% %_what% %_options% /LOG:%_dev2log%
Echo Synchronising to Delivery Server 2 has been completed!
:: End of Delivery 2
::***************************************** Archive Settings **************************************************************************
SET _archiveDest="X:\Some Folder\Deployment\Archive"\%_timestamp%
SEt _archivelog="X:\Some Folder\Deployment\Archive\Logs"\%_timestamp%.txt
SET _ArchiveWhat=/MOVE /E /COPYALL
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree
:: /E :: Copy Subfolders, including Empty Subfolders.
SET _ArchiveOptions=/R:0 /W:0 /XO /LOG:%_archivelog%
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging
:: /IS :: Include Same, overwrite files even if they are already the same. Use this options if you want to overwrite
:: /XO :: eXclude Older - if destination file exists and is the same date or newer than the source - don't bother to overwrite it.
::************************************** End of Archive Settings **********************************************************************
Echo.
Echo Archiving "Deploy Me" folder
ROBOCOPY %_source% %_archiveDest% %_ArchiveWhat% %_ArchiveOptions%
md "X:\Some Folder\Deployment\Deploy Me"
Echo Archive complete!
pause
SETLOCAL
::******************************************* Constants / ROBOCOPY Settings ***********************************************************
SET _what=/COPYALL /E
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree
:: /E :: Copy Subfolders, including Empty Subfolders.
SET _options=/R:0 /W:0 /TS /FP /IS
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging
:: /IS :: Include Same, overwrite files even if they are already the same. Use this options if you want to overwrite
:: /XO :: eXclude Older - if destination file exists and is the same date or newer than the source - don't bother to overwrite it.
SET _timestamp=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%%TIME:~0,2%%TIME:~3,2%
:: This will create a timestamp like yyyymmyyhhmm.
SET _source="X:\source\Deployment\Deploy Me"
:: Source of the files to copy from
::*************************************** End of Constants / ROBOCOPY Settings ********************************************************
:: Delivery 1
SET _dev1="\\delivery1\c$\inetpub\dev.website.com\Website"
SEt _dev1log="X:\delivery1\Deployment\Deployment Logs\APP01"\%_timestamp%.txt
Echo Synchronising Delivery Server 1 with CMS Server
ROBOCOPY %_source% %_dev1% %_what% %_options% /LOG:%_dev1log%
Echo Synchronising to Delivery Server 1 has been completed!
:: End of Delivery 1
Echo.
:: Delivery 2
SET _dev2="\\delivery2\c$\inetpub\dev.website.com\Website"
SEt _dev2log="X:\delivery2\Deployment\Deployment Logs\APP02"\%_timestamp%.txt
Echo Synchronising Delivery Server 2 with CMS Server
ROBOCOPY %_source% %_dev2% %_what% %_options% /LOG:%_dev2log%
Echo Synchronising to Delivery Server 2 has been completed!
:: End of Delivery 2
::***************************************** Archive Settings **************************************************************************
SET _archiveDest="X:\Some Folder\Deployment\Archive"\%_timestamp%
SEt _archivelog="X:\Some Folder\Deployment\Archive\Logs"\%_timestamp%.txt
SET _ArchiveWhat=/MOVE /E /COPYALL
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree
:: /E :: Copy Subfolders, including Empty Subfolders.
SET _ArchiveOptions=/R:0 /W:0 /XO /LOG:%_archivelog%
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging
:: /IS :: Include Same, overwrite files even if they are already the same. Use this options if you want to overwrite
:: /XO :: eXclude Older - if destination file exists and is the same date or newer than the source - don't bother to overwrite it.
::************************************** End of Archive Settings **********************************************************************
Echo.
Echo Archiving "Deploy Me" folder
ROBOCOPY %_source% %_archiveDest% %_ArchiveWhat% %_ArchiveOptions%
md "X:\Some Folder\Deployment\Deploy Me"
Echo Archive complete!
pause
Script to Synchronise Author with Delivery
@ECHO OFF
SETLOCAL
::******************************************* Constants / ROBOCOPY Settings ***********************************************************
SET _what=/COPYALL /E
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree
:: /E :: Copy Subfolders, including Empty Subfolders.
SET _options=/R:0 /W:0 /TS /FP /XO
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging
:: /IS :: Include Same, overwrite files even if they are already the same. Use this options if you want to overwrite
:: /XO :: eXclude Older - if destination file exists and is the same date or newer than the source - don't bother to overwrite it.
SET _timestamp=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%%TIME:~0,2%%TIME:~3,2%
:: This will create a timestamp like yyyymmyyhhmm.
SET _source="C:\inetpub\source\Website"
:: Source of the files to copy from
SET _ExcludeDir= /XD App_Browsers App_Data data temp upload
SET _ExcludeFile= /XF *.specific.config ConnectionStrings.config web.config
::*************************************** End of Constants / ROBOCOPY Settings ********************************************************
:: Delivery 1
SET _dev1="\\delivery1\c$\inetpub\dev.website.com\Website"
SEt _dev1log="X:\delivery1\Deployment\Deployment Logs\APP01"\%_timestamp%.txt
Echo Synchronising Delivery Server 1 with CMS Server
ROBOCOPY %_source% %_dev1% %_what% %_options% %_ExcludeDir% %_ExcludeFile% /LOG:%_dev1log%
Echo Synchronising to Delivery Server 1 has been completed!
:: End of Delivery 1
Echo.
:: Delivery 2
SET _dev2="\\delivery2\c$\inetpub\dev.website.com\Website"
SEt _dev2log="X:\delivery2\Deployment\Deployment Logs\APP02"\%_timestamp%.txt
Echo Synchronising Delivery Server 2 with CMS Server
ROBOCOPY %_source% %_dev2% %_what% %_options% %_ExcludeDir% %_ExcludeFile% /LOG:%_dev2log%
Echo Synchronising to Delivery Server 2 has been completed!
:: End of Delivery 2
pause
SETLOCAL
::******************************************* Constants / ROBOCOPY Settings ***********************************************************
SET _what=/COPYALL /E
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree
:: /E :: Copy Subfolders, including Empty Subfolders.
SET _options=/R:0 /W:0 /TS /FP /XO
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging
:: /IS :: Include Same, overwrite files even if they are already the same. Use this options if you want to overwrite
:: /XO :: eXclude Older - if destination file exists and is the same date or newer than the source - don't bother to overwrite it.
SET _timestamp=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%%TIME:~0,2%%TIME:~3,2%
:: This will create a timestamp like yyyymmyyhhmm.
SET _source="C:\inetpub\source\Website"
:: Source of the files to copy from
SET _ExcludeDir= /XD App_Browsers App_Data data temp upload
SET _ExcludeFile= /XF *.specific.config ConnectionStrings.config web.config
::*************************************** End of Constants / ROBOCOPY Settings ********************************************************
:: Delivery 1
SET _dev1="\\delivery1\c$\inetpub\dev.website.com\Website"
SEt _dev1log="X:\delivery1\Deployment\Deployment Logs\APP01"\%_timestamp%.txt
Echo Synchronising Delivery Server 1 with CMS Server
ROBOCOPY %_source% %_dev1% %_what% %_options% %_ExcludeDir% %_ExcludeFile% /LOG:%_dev1log%
Echo Synchronising to Delivery Server 1 has been completed!
:: End of Delivery 1
Echo.
:: Delivery 2
SET _dev2="\\delivery2\c$\inetpub\dev.website.com\Website"
SEt _dev2log="X:\delivery2\Deployment\Deployment Logs\APP02"\%_timestamp%.txt
Echo Synchronising Delivery Server 2 with CMS Server
ROBOCOPY %_source% %_dev2% %_what% %_options% %_ExcludeDir% %_ExcludeFile% /LOG:%_dev2log%
Echo Synchronising to Delivery Server 2 has been completed!
:: End of Delivery 2
pause
Thursday, July 7, 2011
Sitecore Encrypting Connection String and etc
Recently, I was asked to encrypt connection strings. Here are the codes
Encrypting
----------
@ECHO OFF
ECHO Encrypting web.config connectionStrings ...
SET target="C:\inetpub\folder\Website"
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/membership" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/roleManager" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/profile" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/machineKey" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "connectionStrings" %target%
ECHO Finished Encrypting web.config connectionStrings...
pause
Decrypting
----------
@ECHO OFF
ECHO Decrypting web.config connectionStrings ...
SET target="C:\inetpub\folder\Website"
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/membership" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/roleManager" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/profile" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/machineKey" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "connectionStrings" %target%
ECHO Finished Decrypting web.config connectionStrings...
pause
Encrypting
----------
@ECHO OFF
ECHO Encrypting web.config connectionStrings ...
SET target="C:\inetpub\folder\Website"
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/membership" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/roleManager" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/profile" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/machineKey" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "connectionStrings" %target%
ECHO Finished Encrypting web.config connectionStrings...
pause
Decrypting
----------
@ECHO OFF
ECHO Decrypting web.config connectionStrings ...
SET target="C:\inetpub\folder\Website"
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/membership" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/roleManager" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/profile" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/machineKey" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "connectionStrings" %target%
ECHO Finished Decrypting web.config connectionStrings...
pause
Subscribe to:
Posts (Atom)