title: Buffer cannot be null. Parameter name: buffer
body: <p>I have written code to send an email with a link to a URL, which the user has to click for confirmation.</p>
  
  <p>Sample Link:
  <a href="http://localhost:3531/VerificationModule/VerifyEmail.aspx?TemplateID=519457608&amp;F960866879F669E=Tw5NpFeW9HsAqc_Ap5dmOwqkZ041pFQGYLxRV-puumtHsfhrTYtDe51uCbGV44Kc1X3n6cggsynfqRmh74ie535ymkvATeK5Jii11tOMIZDZ_GVB8QolLeMU5i6KWEZculKhM0IOhYFaMc-DsB" rel="nofollow">http://localhost:3531/VerificationModule/VerifyEmail.aspx?TemplateID=519457608&amp;F960866879F669E=Tw5NpFeW9HsAqc_Ap5dmOwqkZ041pFQGYLxRV-puumtHsfhrTYtDe51uCbGV44Kc1X3n6cggsynfqRmh74ie535ymkvATeK5Jii11tOMIZDZ_GVB8QolLeMU5i6KWEZculKhM0IOhYFaMc-DsB</a></p>
  
  <p>But when the user clicks the link, it gets opened in the browser, but displays the following error.</p>
  
  <blockquote>
    <p><strong>"Buffer cannot be null. Parameter name: buffer"</strong></p>
    
    <p>Please find below the stack trace:</p>
  </blockquote>
  
  <pre><code>[ArgumentNullException: Buffer cannot be null.
   Parameter name: buffer]
   System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable) +9629927
   System.IO.MemoryStream..ctor(Byte[] buffer) +6
   Auth.IdentityTokenXChangeData.Deserialize(String base64Package) +187
   Auth.IdentityTokenXChange.TrySniffIdentityToken(HttpRequest req, String&amp; sessionId, String&amp; sessionTag, String&amp; returnUrl) +244
   Auth.IdentityModule.OnBeginRequest(Object sender, EventArgs e) +365
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  +220
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;   completedSynchronously) +120`
  </code></pre>
  
  <p>This is eating up my day. Any suggestion would be of great help.</p>
  
  <p>Got a clue on the error..
  I believe the problem is with Encoded value in the QueryString </p>
  
  <pre><code>("F960866879F669E=Tw5NpFeW9HsAqc_Ap5dmOwqkZ041pFQGYLxRV-puumtHsfhrTYtDe51uCbGV44Kc1X3n6cggsynfqRmh74ie535ymkvATeK5Jii11tOMIZDZ_GVB8QolLe‌​MU5i6KWEZculKhM0IOhYFaMc-DsB") - 
  </code></pre>
  
  <p>The Base64 Decode is returning 'null' for some reasons. </p>
  
  <pre><code>Method -
  'System.Web.HttpServerUtility.UrlTokenDecode
  ("F960866879F669E=Tw5NpFeW9HsAqc_Ap5dmOwqkZ041pFQGYLxRV-puumtHsfhrTYtDe51uCbGV44Kc1X3n6cggsynfqRmh74ie535ymkvATeK5Jii11tOMIZDZ_GVB8QolLe‌​MU5i6KWEZculKhM0IOhYFaMc-DsB")'
  </code></pre>
  
  <p>Any idea on why it returns null? Is it not a valid Base64 encode?</p>