Tuesday, May 12, 2009

Standalone apps under Sitecore web root

As this article suggests, it is possible though not officially recommended. Here is an update for what you need to do in Sitecore 6 to make it happen.

- Open the web.config of your standalone web app.
- Locate <httpHandlers>section under <system.web> and remove Sitecore specific http handlers:

<httpHandlers>
   <remove verb="*" path="sitecore_media.ashx"/>
   <remove verb="*" path="sitecore_xaml.ashx"/>
   <remove verb="*" path="sitecore_icon.ashx"/>
   ...
</httpHandlers>

- Do the same thing for httpModules section:

<httpModules>
   <remove name="SitecoreHttpModule" />
   <remove name="SitecoreUploadWatcher" />
   <remove name="SitecoreXslWatcher" />
   <remove name="SitecoreLayoutWatcher" />
   <remove name="SitecoreConfigWatcher" />
   ...
</httpModules>

- If you are running on IIS7 in integrated mode, you will need to the same thing for the <system.webServer> section:

<modules runAllManagedModulesForAllRequests="true">
   <remove name="SitecoreHttpModule" />
   <remove name="SitecoreUploadWatcher" />
   <remove name="SitecoreXslWatcher" />
   <remove name="SitecoreLayoutWatcher" />
   <remove name="SitecoreConfigWatcher" />
   ...
</modules>
 
<handlers>
   ...
   <remove name="Sitecore.MediaRequestHandler" />
   <remove name="Sitecore.XamlPageRequestHandler" />
   <remove name="Sitecore.IconRequestHandler" />
   ...
</handlers>
 
- Your standalone app will most likely use its own membership provider(s), so you will need to disable Sitecore membership provider:
<membership defaultProvider="AspNetSqlMembershipProvider">
   <providers>
      <remove name="sitecore" />
      ...
   </providers>
</membership>

- If neither role nor profile providers are used, disable them or if you do use them, add the remove statement the same way as it it shown above for the membership provider.

<profile enabled="false">
   ...
</profile>
<roleManager enabled="false">
   ...
</roleManager>

This way you can easily have an MVC app running in a virtual application (separate pool) of your Sitecore website.

Friday, May 08, 2009

Altering the behavior of the tree view control

You may have noticed this too. When you create a template, the Base Template dropdown may be tricky to operate with. If you are trying to find a template in the subfolders to inherit from and miss the expansion plus, the tree will collapse and you will have to start over. This has been bugging me for a while so I asked the tech support if there is an easy way to fix this and not have the tree to collapse.
Luckily, there is an easy fix, but you will have to mess with the Sitecore.js file located under /sitecore/shell/controls.

What you need to do is to add a global variable in Sitecore.js:

var iAmTree = null;

Then straight after line 563 within scSitecore.prototype.postEvent = function(tag, evt, parameters) add the following:

iAmTree = false;                                                                                      
if (ctl.className.toString() == "scTreeItem") iAmTree = true;  

And finally within scRequest.prototype.resume = function() alter this IF statement:

if (this.closePopups && typeof(scForm) != "undefined") {
    scForm.browser.closePopups("Request");
  }

to this:

if (this.closePopups && typeof(scForm) != "undefined" && iAmTree != true) {
    scForm.browser.closePopups("Request");
  }

This will also affect the Droptree field’s behavior and possibly more areas.

And you may have guessed – create a backup of Sitecore.js file and use the solution on your own risk ;-)

Special thanks goes to Ruslan for providing the fix.

Thursday, April 09, 2009

How to troubleshoot SQL connection issues

Had a problem with remote web app not connection to newly installed SQL Server. Was getting generic “A network-related or instance-specific error occurred while establishing a connection to SQL Server…”

Found this great article with the breakdown of possible scenarios, very useful. Mine was #6, SQLBrowser not running. Was clicking too fast through the installation ;-)