title: How do I workaround this SSRS authentication exception?
body: <p>I am trying to implement some custom security code into SSRS 2008 (not R2) to allow for Forms Authentication instead of Windows Authentication. I have based my solution on the Microsoft sample code and have managed to get most of it working absolutely fine. The only area where I'm having problems is when logging onto the actual Report Manager URL.</p>
  
  <p><strong>Issue 1</strong>
  When using the URL <code>http://localhost/Reports_MSSQL2008/</code> it doesn't pick up the <code>UILogon.aspx</code> page that i've copied into the <code>/Pages</code> folder (as instructed by the Microsoft example). I have amended the web.config in the ReportManager folder to contain the following:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="UILogon.aspx" 
           name="sqlAuthCookie" 
           timeout="60" 
           slidingExpiration="true" 
           path="/" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>I have tried changing the path to match exact path of the aspx file, but still no joy !! </p>
  
  <p><strong>Issue 2</strong>
  Because of the issue above, I tried just getting into UILogon and ReportManager via the URL, <code>http://localhost/Reports_MSSQL2008/Pages/UILogon.aspx</code>. This works in that I get to step into my custom code (UILogon.aspx.cs and IAuthorisation / IAuthentication code) and I can see it doing the following:</p>
  
  <ul>
  <li>authenticating / authorising the user</li>
  <li>creating the cookie</li>
  <li>storing the cookie (sqlAuthCookie) on the response / request cookie container</li>
  <li>performing the response.redirect to the /Folder.aspx page</li>
  </ul>
  
  <p>Problem is, when the response.redirect comes back into the GetUserInfo() method, the HttpContext.Current.User is null, and there is no cookie anymore. Because of this, a null IIdentity is returned (cant set it to anything else !!) and SSRS throws the error...</p>
  
  <blockquote>
    <p>Microsoft.ReportingServices.Diagnostics.Utilities.AuthenticationExtensionException:<br>
    The Authentication Extension threw an unexpected exception or returned a value that is not valid: identity==null.</p>
  </blockquote>
  
  <p>For info - when I launch Report Builder / Visual Studio bi proj / the Web Service URL it does exactly what I require and works fine......it's just the Report Manager thats causing the problem.</p>