locked
did i do something wrong here? RRS feed

  • Question

  • User-1922277577 posted

    <%@ Page Language="VB" AutoEventWireup="false" ContentType="image/gif" %>

    <%@ Import Namespace="System.Drawing" %>

    <%@ Import Namespace="System.Drawing.Imaging" %>

    <script language="VB" runat="server">

    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    Response.ContentType = "image/gif"

    Dim copy As Bitmap = New Bitmap(100, 100)

    Dim g As Graphics = Graphics.FromImage(copy)

    Dim f As Font = New Font("Tahoma", 11, FontStyle.Bold)

    g.DrawString("Test", f, New SolidBrush(Color.Green), 0, 0)

    copy.Save(Response.OutputStream, ImageFormat.Gif)

    g.Dispose()

    copy.Dispose()

    End Sub

    </script>

     

    this file is called genimage.aspx. i want to have this file display a dynamicly generated image in another page. at the other page, it will look something like this:

    <asp:Image ID="Image1" runat="server" ImageUrl="barcode.aspx" />

    But it seems that genimage.aspx doesn't want to work. Can anybody help me with this??

    Thanks,

    Alan,

    Sunday, April 9, 2006 11:43 PM

All replies

  • User933648302 posted
    ImageUrl property should be genimage.aspx not barcode.aspx?

    also try adding
    Response.StatusCode = 200;
    Response.End();
    after disposing the objects
    Monday, April 10, 2006 12:39 AM
  • User-1922277577 posted

    Hi,

    thanks for replying. I still can't get it to work. Here is the most current modified code:

    genimage.aspx:

    <%@ Page Language="VB" AutoEventWireup="false" ContentType="image/gif" %>

    <%@ Import Namespace="System.Drawing" %>

    <%@ Import Namespace="System.Drawing.Imaging" %>

    <script language="VB" runat="server">

    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    Response.ContentType = "image/gif"

    Dim copy As Bitmap = New Bitmap(100, 100)

    Dim g As Graphics = Graphics.FromImage(copy)

    Dim f As Font = New Font("Tahoma", 11, FontStyle.Bold)

    g.DrawString("Test", f, New SolidBrush(Color.Green), 0, 0)

    copy.Save(Response.OutputStream, ImageFormat.Gif)

    g.Dispose()

    copy.Dispose()

    Response.StatusCode = 200

    Response.End()

    End Sub

    </script>

    and i made the change to the page calling genimage.aspx also, still doesn't work... i did look at references and I do have system.drawing... 

     

    Thanks,

     

    Alan,

     

    Monday, April 10, 2006 1:01 AM