A
Adam Eccleshall
Hi,
I don't know if this is the right forum for this question - if not, please
point me at the right one.
I have a website .dll / .aspx project in VS2005 which receives a string of
parameters in the query string and returns a PNG image in the HTTP response.
The current form of the program is
-----------------------
Bitmap bitmap = new Bitmap(500, 100);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
Font displayFont = new Font("Times New Roman", 32);
Color displayColour = Color.FromArgb(128, 128, 128);
Brush displayBrush = new SolidBrush(displayColour);
Pen pen = new Pen(displayColour);
System.Collections.Specialized.NameObjectCollectionBase.KeysCollection Keys =
this.Request.QueryString.Keys;
// Do something with the query string
// Make sure the browser interprets it as the right type
this.Response.ContentType = "image/png";
this.Response.StatusCode = 200;
// Write the image to the http response via a memory stream
MemoryStream ms = new System.IO.MemoryStream();
bitmap.Save(ms, ImageFormat.Png);
ms.WriteTo(this.Response.OutputStream);
-----------------------
This code is called via <img
src="http://someurl/DynamicImage.aspx?someparameters">, and generally works
as expected. the problem is that due to the nature of the date it uses, it
is quite easy for the parameter list to puch the URL beyond the 2083
character limit, thus returning either a bad image or (if I truncate the URL
before the call), an incomplete representation of the data.
Is there some way I can modify my code such that it doesn't need to use the
query string? I thought of using POST to send the data rather than GET, but
the images need to be embedded in non-form pages.
Is there, perhaps, a way of reading attributes in the <img> tag, or are they
client-side only?
Thank you,
Adam
I don't know if this is the right forum for this question - if not, please
point me at the right one.
I have a website .dll / .aspx project in VS2005 which receives a string of
parameters in the query string and returns a PNG image in the HTTP response.
The current form of the program is
-----------------------
Bitmap bitmap = new Bitmap(500, 100);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
Font displayFont = new Font("Times New Roman", 32);
Color displayColour = Color.FromArgb(128, 128, 128);
Brush displayBrush = new SolidBrush(displayColour);
Pen pen = new Pen(displayColour);
System.Collections.Specialized.NameObjectCollectionBase.KeysCollection Keys =
this.Request.QueryString.Keys;
// Do something with the query string
// Make sure the browser interprets it as the right type
this.Response.ContentType = "image/png";
this.Response.StatusCode = 200;
// Write the image to the http response via a memory stream
MemoryStream ms = new System.IO.MemoryStream();
bitmap.Save(ms, ImageFormat.Png);
ms.WriteTo(this.Response.OutputStream);
-----------------------
This code is called via <img
src="http://someurl/DynamicImage.aspx?someparameters">, and generally works
as expected. the problem is that due to the nature of the date it uses, it
is quite easy for the parameter list to puch the URL beyond the 2083
character limit, thus returning either a bad image or (if I truncate the URL
before the call), an incomplete representation of the data.
Is there some way I can modify my code such that it doesn't need to use the
query string? I thought of using POST to send the data rather than GET, but
the images need to be embedded in non-form pages.
Is there, perhaps, a way of reading attributes in the <img> tag, or are they
client-side only?
Thank you,
Adam