by Njål

Intelligencia UrlRewriter – Ashx Sessions getting lost


When debugging a Windows Azure website I kept getting null Sessions for my ashx pages. They worked perfectly on  IISExpress, so I thought this was a Azure flaw. It turned out that it was IIS 7.5 + Url Rewriting (I’m using the Intelligencia module) that caused the problem.



After adding this to my Web.config everything worked like expected again – also in IIS 7.5

    <modules runAllManagedModulesForAllRequests="true" >

Also – make sure your ashx code implements IRequiresSessionState

public class ApiHandler : IHttpHandler, IRequiresSessionState