adding alternate text to a programmatically created image
<p>So I have an ashx file that creates an image with text written on it.</p>

<pre><code>//create the image for the string
Font f = new Font("Arial", 15F);
Graphics g = Graphics.FromImage(b);
SolidBrush whiteBrush = new SolidBrush(Color.FromArgb(0,71,133));
SolidBrush blackBrush = new SolidBrush(Color.White);
RectangleF canvas = new RectangleF(0, 0, 105, 45);
g.FillRectangle(whiteBrush, canvas);
context.Session["test"] = randomString;
g.DrawString(context.Session["test"].ToString(), f, blackBrush, canvas);
context.Response.ContentType = "image/gif";
b.Save(context.Response.OutputStream, ImageFormat.Gif);
</code></pre>

<p>When called, it creates the image I want, but realized that it doesn't have have an alt text option for accessibility purposes.</p>

<p>Any idea on how to add alternate text to an image?  </p>

<p>In my aspx page I have this:</p>

<pre><code> &lt;asp:Image ID="myImage" class="styleimage" src="ImageMaker.ashx" runat="server"/&gt;
</code></pre>

<p>I have tried: </p>

<pre><code>myImage.AlternateText = HttpContext.Current.Session["test"].ToString(); 
</code></pre>

<p>I receive a <code>NullReferenceException</code>.</p>

<p>This apparently happens because <code>Session["test"]</code> gets populated after the page load ( so the page loads, the image gets rendered, then the handler gets called).</p>

<p>How do I solve this?</p>
