M
malcolm
I've seen several posts around the Internet and many of them either
don't work or only partially work. All I'm trying to do is record some
action asynchronously from an html file, a sort of logging mechanism.
The product is a CD catalog that will be delivered to many customers
and they want the ability to log specific pages accross the Internet,
and there's no gaurantee these people will be connected to the
Internet, the ones that are though, we want to log their actions. I've
done something similar in COM a while ago, but can't get it to work in
..NET.
Thus, i will put an 1 X 1 pixel image tag at the bottom of each page I
want logged. I'm also going to pass querystring information, which is
all perfectly legal in HTML as long as your output is binary.
<img src="http://www.domain.com/log.aspx?a=33&b=467">
All I'm trying to do is write the log.aspx page to simply return an
image that I have stored on my webserver. it should return the same
1X1 transparent image every time. Behind the scenes, the aspx page
will log the querystring info to the db (this part's done).
Here's the best way I've got it to work (code is simplified to
relevant parts), but it has 2 problems: 1) it creates the image on the
fly (don't think that's necessary) and 2) the image is not transparent
(even after setting many settings on the bitmap object).
private void Page_Load(object sender, System.EventArgs e)
{
Bitmap bitmap = new Bitmap(1, 1);
try
{
Response.ContentType = "image/gif";
bitmap.Save(Response.OutputStream, ImageFormat.Gif);
}
catch {}
finally
{
bitmap.Dispose();
}
}
I'm guessing there's a simpler (much different) way to achieve this.
That is, load an image from the fileserver and spit it out to the
window. I've spent several hours messing around with stream objects
and such, but can't find the right way...
Thanks, in advance, for any help!
-dave
don't work or only partially work. All I'm trying to do is record some
action asynchronously from an html file, a sort of logging mechanism.
The product is a CD catalog that will be delivered to many customers
and they want the ability to log specific pages accross the Internet,
and there's no gaurantee these people will be connected to the
Internet, the ones that are though, we want to log their actions. I've
done something similar in COM a while ago, but can't get it to work in
..NET.
Thus, i will put an 1 X 1 pixel image tag at the bottom of each page I
want logged. I'm also going to pass querystring information, which is
all perfectly legal in HTML as long as your output is binary.
<img src="http://www.domain.com/log.aspx?a=33&b=467">
All I'm trying to do is write the log.aspx page to simply return an
image that I have stored on my webserver. it should return the same
1X1 transparent image every time. Behind the scenes, the aspx page
will log the querystring info to the db (this part's done).
Here's the best way I've got it to work (code is simplified to
relevant parts), but it has 2 problems: 1) it creates the image on the
fly (don't think that's necessary) and 2) the image is not transparent
(even after setting many settings on the bitmap object).
private void Page_Load(object sender, System.EventArgs e)
{
Bitmap bitmap = new Bitmap(1, 1);
try
{
Response.ContentType = "image/gif";
bitmap.Save(Response.OutputStream, ImageFormat.Gif);
}
catch {}
finally
{
bitmap.Dispose();
}
}
I'm guessing there's a simpler (much different) way to achieve this.
That is, load an image from the fileserver and spit it out to the
window. I've spent several hours messing around with stream objects
and such, but can't find the right way...
Thanks, in advance, for any help!
-dave