title: Display base64 image using generic handler(ashx)
body: <p>I am trying to display base64 using generic handler but not getting success. Here is my code of generic handler:</p>
  
  <pre><code>public class UserProfilePhoto : IHttpHandler, IReadOnlySessionState
  {
          public void ProcessRequest(HttpContext context)
          {
              try
              {
  
                  if (UserSession.Get().UserPhoto == null)
                  {
                      context.Response.ContentType = "image/png";
                      context.Response.WriteFile("~/assets/img/avatar.png");
                  }
                  else
                  {
                      context.Response.ContentType = UserSession.Get().UserPhoto.Substring(0, UserSession.Get().UserPhoto.IndexOf(","));
                      context.Response.Write(UserSession.Get().UserPhoto);
                  }
              }
              catch (Exception ex)
              {
                  throw ex;
              }
          }
  
          public bool IsReusable
          {
              get
              {
                  return true;
              }
          }
      }
  </code></pre>
  
  <p>Calling on view-page like below:</p>
  
  <pre><code>&lt;img alt="Photo" ng-src="UserProfilePhoto.ashx" /&gt;
  </code></pre>
  
  <p>It's not changing src of img tag. I don't know what is wrong. help. <a href="http://paste2.org/_ygYjs6tz" rel="nofollow">Here is the base64 string which I am getting from database.</a></p>