graphics in ASP.NET

topic posted Mon, August 11, 2008 - 9:16 AM by  Toby
Share/Save/Bookmark
Advertisement
I followed a tutorial for drawing graphics in an asp page but there is an error.(may look familiar)

Here's my page_Load code:

Response.ContentType = "image/jpeg";

Bitmap objBitmap;
Graphics objGraphics;

objBitmap = new Bitmap(200, 200);
objGraphics = Graphics.FromImage(objBitmap);

objGraphics.DrawLine(new Pen(System.Drawing.Color.Red), 0, 0, 200, 200);

objBitmap.Save(Response.OutputStream, ImageFormat.Gif);

objBitmap.Dispose();
objGraphics.Dispose();


the error is : the image " http://localhost:1653/Default.aspx \" cannot be displayed because of an error.


What is missing that is causing the problem?
Do I actually have to have an image load from someplace?
I'm not trying to do html text at the same time.
posted by:
Toby
Seattle
Advertisement
Advertisement

Recent topics in "C#"

Topic Author Replies Last Post
classes for music Toby 0 October 8, 2007
How long doing C#? Genghis "Doh!" 8 June 4, 2007
Visual Studio Question Toby 0 April 15, 2006
Sr C#/.NET Eng job oppty in Chicago Unsubscribed 0 May 5, 2005
Urgent help for Visual Basic or C#! Unsubscribed 0 September 12, 2004