Sometimes it is handy to give out a link to a business users that will lead to a specific mode in Sitecore. For example, you send out an email notification from workflow using email actions <link to sdn5> and would like to control where the users go after the authentication.

Imagine the following email was sent out from Sitecore with a list of links:

Hello Amy,

The item “About Us” was submitted for approval by user “mark” on Aug 15th 2008. Please login to CMS and review the content using one of the following modes:

http://sandbox531071114/sitecore/login/default.aspx?mode=webedit&scitemid=%7b3D1814ED-55DD-4518-BD2C-809393F94D2D%7d_

http://sandbox531071114/sitecore/login/default.aspx?mode=preview&scitemid=%7b3D1814ED-55DD-4518-BD2C-809393F94D2D%7d_

http://sandbox531071114/sitecore/login/default.aspx?mode=workbox

Best Regards, Sitecore CMSSending out those links is pretty straightforward, while having Sitecore function according to the scenario requires some adjustments.

The first thing that you should do is add a processor to the “login” pipeline that will perform the dynamic switch between the modes by adjusting the LoginArgs’ StartUrl judging by the “mode” query string you pass in the initial URL:

 1: <login argsType="Sitecore.Pipelines.Login.LoginArgs">
 2: <processor mode="on" type="Sitecore.Pipelines.Login.LoginCookie, Sitecore.Kernel" />
 3: <processor mode="on" type="Sitecore.Pipelines.Login.Login, Sitecore.Kernel" />
 4: <processor mode="on" type="Sitecore.Pipelines.Login.Settings, Sitecore.Kernel" />
 5: <processor mode="on" type="Sitecore.Pipelines.Login.Ticket, Sitecore.Kernel" />
 6: <processor mode="on" type="Sitecore.Pipelines.Login.CheckStartPage, Sitecore.Kernel" />
 7: <processor mode="on" type="SCUSAINC.Web.Pipelines.Login.ModeRedirector, SCUSAINC.Web" />
 8: </login>
 9: 
Depending on the value of the “mode” attribute passed, you can assign one of the following string values:

  • For the Workbox mode - "/sitecore/shell/applications/workbox/workbox.aspx"
  • For the WebEdit mode - "/sitecore/shell/applications/webedit.aspx"
  • For the Preview mode - "/sitecore/shell/applications/preview.aspx"Since for both WebEdit and Preview you are interested in the redirect to a particular item, you should also pass on the “scitemid” query string retrieved from the initial link. So the request will come in to the Sitecore login page with the mode parameter and possibly the scitemid parameter as well. After user logs in, the ModeRedirector is called as a last processor and the StartUrl is adjusted accordingly. Then it is all semi-automatic. No matter what mode user selects in the login page options, the query string parameters will always prevail. So if a switch to Workbox occurred, Sitecore will handle this automatically. In case of Preview and WebEdit, the aspx pages do not take advantage of the query string passed to the previous request. In other words, by default, the “sc_itemid” parameter will be neglected. In order to get around this, you can simply override those pages, grab the parameter and pass it on. You can download the package with the solution from It contains the code for the ModeRedirector and the overriding code for Preview.aspx and WebEdit.aspx which are located under “/Sitecore/shell/Applications” and also some utility class. I should mention that this was developed on 5.3.1 but with proper adjustments I don’t see any reason why this should not fly on version 6. here.