Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Image in FireFox is fine, but not in IE

 
   Web Hosting Problem Solving Community! (Home) -> IIS RSS
Next:  Weird request from buyer of my domain  
Author Message
thejackofall

External


Since: Jan 31, 2008
Posts: 3



(Msg. 1) Posted: Thu Jan 31, 2008 8:49 pm
Post subject: Image in FireFox is fine, but not in IE
Archived from groups: microsoft>public>inetserver>iis (more info?)

I wrote an ISAPI filter that collects and modifies the data before sending it
down to the browser, including the images.

The image shows fine in FireFox, but it's shows the X image marker in IE
instead of the image. When I save the data to a file and open it, I
noticed the image binary is cut off by what I think is a carriage return or
new line character. In my code, I collect the data in the string type in
C++.

Has anyone experienced this problem? If you have a solution, please let me
know.

--
Be Cool!

 >> Stay informed about: Image in FireFox is fine, but not in IE 
Back to top
Login to vote
Anthony Jones

External


Since: Jan 28, 2006
Posts: 170



(Msg. 2) Posted: Fri Feb 01, 2008 5:11 am
Post subject: Re: Image in FireFox is fine, but not in IE [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"thejackofall" <thejackofall RemoveThis @discussions.microsoft.com> wrote in message
news:EB82B249-2C94-41E4-83BE-C31308388E0F@microsoft.com...
> I wrote an ISAPI filter that collects and modifies the data before sending
it
> down to the browser, including the images.
>
> The image shows fine in FireFox, but it's shows the X image marker in IE
> instead of the image. When I save the data to a file and open it, I
> noticed the image binary is cut off by what I think is a carriage return
or
> new line character. In my code, I collect the data in the string type in
> C++.
>
> Has anyone experienced this problem? If you have a solution, please let
me > know.
>


It would help if you posted some code, although using a 'string' type to
hold binary data doesn't sound too sensible when C++ gives you plenty of
other options.

--
Anthony Jones - MVP ASP/ASP.NET

 >> Stay informed about: Image in FireFox is fine, but not in IE 
Back to top
Login to vote
thejackofall

External


Since: Jan 31, 2008
Posts: 3



(Msg. 3) Posted: Fri Feb 01, 2008 11:08 am
Post subject: Re: Image in FireFox is fine, but not in IE [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks, Anthony.

The reason I use the string type is because I do keyword replacements, and
the best way to do that is to use the string type which gives me find() with
other string manipulations.

Here is my code.

DWORD WINAPI __stdcall HttpFilterProc(HTTP_FILTER_CONTEXT *pfc, DWORD
NotificationType, VOID *pvData)
{
PHTTP_FILTER_RAW_DATA pRaw = NULL;

switch (NotificationType)
{
case SF_NOTIFY_SEND_RAW_DATA:
{
pRaw = (PHTTP_FILTER_RAW_DATA) pvData;
string sDataTemp((CHAR*) pRaw->pvInData, pRaw->cbInData);
AutoLinkContext* pALC = (AutoLinkContext*) pfc->pFilterContext;
int iPosition1 = sDataTemp.find("Content-Length:");

if (pALC == NULL && iPosition1 != string::npos)
{
int iPosition2 = sDataTemp.find("\r\n\r\n");

if (iPosition2 != string::npos)
{
pALC = new AutoLinkContext();

if (pALC != NULL)
{
pALC->iSent = 0;
pALC->sContentLength = sDataTemp.substr(iPosition1 + 16, iPosition2 -
(iPosition1 + 16));
pALC->sHeader.resize(sDataTemp.length());
sDataTemp.copy((LPSTR) pALC->sHeader.c_str(), sDataTemp.length());
pfc->pFilterContext = pALC;
}

pRaw->cbInData = 0;
pRaw->pvInData = NULL;
}
}
else if (pALC != NULL && pALC->iSent == 0)
{
pALC->sData.replace(pALC->sData.length(), sDataTemp.length(), sDataTemp);
pRaw->cbInData = 0;
pRaw->pvInData = NULL;
}

break;
}

case SF_NOTIFY_END_OF_REQUEST:
{
AutoLinkContext* pALC = (AutoLinkContext*) pfc->pFilterContext;

if (pALC != NULL)
{

string sNewContentLength;
sNewContentLength.resize(pALC->sContentLength.length());
itoa(pALC->sData.length(), (LPSTR) sNewContentLength.c_str(), 10);

int iPosition = pALC->sHeader.find("Content-Length:") + 16;
pALC->sHeader.replace(iPosition, sNewContentLength.length(),
sNewContentLength);
pALC->sHeader.append("\r\n");
pALC->sHeader.replace(pALC->sHeader.length(), pALC->sData.length(),
pALC->sData);
pALC->iSent = 1;
DWORD dwData = (DWORD) ((int) pALC->sHeader.length());
pfc->WriteClient(pfc, (LPVOID) pALC->sHeader.c_str(), &dwData, 0);
}

break;
}

case SF_NOTIFY_END_OF_NET_SESSION:
{
if (pfc != NULL)
{
AutoLinkContext* pALC = (AutoLinkContext*) pfc->pFilterContext;

if (pALC != NULL)
{
pALC->iSent = 1;
pALC->sData.clear();
pALC->sContentLength.clear();
pALC->sHeader.clear();
pALC = NULL;
}
}

break;
}

default:
break;
}

return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
--
Be Cool!


"Anthony Jones" wrote:

> "thejackofall" <thejackofall.DeleteThis@discussions.microsoft.com> wrote in message
> news:EB82B249-2C94-41E4-83BE-C31308388E0F@microsoft.com...
> > I wrote an ISAPI filter that collects and modifies the data before sending
> it
> > down to the browser, including the images.
> >
> > The image shows fine in FireFox, but it's shows the X image marker in IE
> > instead of the image. When I save the data to a file and open it, I
> > noticed the image binary is cut off by what I think is a carriage return
> or
> > new line character. In my code, I collect the data in the string type in
> > C++.
> >
> > Has anyone experienced this problem? If you have a solution, please let
> me > know.
> >
>
>
> It would help if you posted some code, although using a 'string' type to
> hold binary data doesn't sound too sensible when C++ gives you plenty of
> other options.
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>
 >> Stay informed about: Image in FireFox is fine, but not in IE 
Back to top
Login to vote
thejackofall

External


Since: Jan 31, 2008
Posts: 3



(Msg. 4) Posted: Fri Feb 01, 2008 3:20 pm
Post subject: Re: Image in FireFox is fine, but not in IE [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for your assistance.

I resolved the issue, and my images are shown correctly.

--
Be Cool!


"thejackofall" wrote:

> Thanks, Anthony.
>
> The reason I use the string type is because I do keyword replacements, and
> the best way to do that is to use the string type which gives me find() with
> other string manipulations.
>
> Here is my code.
>
> DWORD WINAPI __stdcall HttpFilterProc(HTTP_FILTER_CONTEXT *pfc, DWORD
> NotificationType, VOID *pvData)
> {
> PHTTP_FILTER_RAW_DATA pRaw = NULL;
>
> switch (NotificationType)
> {
> case SF_NOTIFY_SEND_RAW_DATA:
> {
> pRaw = (PHTTP_FILTER_RAW_DATA) pvData;
> string sDataTemp((CHAR*) pRaw->pvInData, pRaw->cbInData);
> AutoLinkContext* pALC = (AutoLinkContext*) pfc->pFilterContext;
> int iPosition1 = sDataTemp.find("Content-Length:");
>
> if (pALC == NULL && iPosition1 != string::npos)
> {
> int iPosition2 = sDataTemp.find("\r\n\r\n");
>
> if (iPosition2 != string::npos)
> {
> pALC = new AutoLinkContext();
>
> if (pALC != NULL)
> {
> pALC->iSent = 0;
> pALC->sContentLength = sDataTemp.substr(iPosition1 + 16, iPosition2 -
> (iPosition1 + 16));
> pALC->sHeader.resize(sDataTemp.length());
> sDataTemp.copy((LPSTR) pALC->sHeader.c_str(), sDataTemp.length());
> pfc->pFilterContext = pALC;
> }
>
> pRaw->cbInData = 0;
> pRaw->pvInData = NULL;
> }
> }
> else if (pALC != NULL && pALC->iSent == 0)
> {
> pALC->sData.replace(pALC->sData.length(), sDataTemp.length(), sDataTemp);
> pRaw->cbInData = 0;
> pRaw->pvInData = NULL;
> }
>
> break;
> }
>
> case SF_NOTIFY_END_OF_REQUEST:
> {
> AutoLinkContext* pALC = (AutoLinkContext*) pfc->pFilterContext;
>
> if (pALC != NULL)
> {
>
> string sNewContentLength;
> sNewContentLength.resize(pALC->sContentLength.length());
> itoa(pALC->sData.length(), (LPSTR) sNewContentLength.c_str(), 10);
>
> int iPosition = pALC->sHeader.find("Content-Length:") + 16;
> pALC->sHeader.replace(iPosition, sNewContentLength.length(),
> sNewContentLength);
> pALC->sHeader.append("\r\n");
> pALC->sHeader.replace(pALC->sHeader.length(), pALC->sData.length(),
> pALC->sData);
> pALC->iSent = 1;
> DWORD dwData = (DWORD) ((int) pALC->sHeader.length());
> pfc->WriteClient(pfc, (LPVOID) pALC->sHeader.c_str(), &dwData, 0);
> }
>
> break;
> }
>
> case SF_NOTIFY_END_OF_NET_SESSION:
> {
> if (pfc != NULL)
> {
> AutoLinkContext* pALC = (AutoLinkContext*) pfc->pFilterContext;
>
> if (pALC != NULL)
> {
> pALC->iSent = 1;
> pALC->sData.clear();
> pALC->sContentLength.clear();
> pALC->sHeader.clear();
> pALC = NULL;
> }
> }
>
> break;
> }
>
> default:
> break;
> }
>
> return SF_STATUS_REQ_NEXT_NOTIFICATION;
> }
> --
> Be Cool!
>
>
> "Anthony Jones" wrote:
>
> > "thejackofall" <thejackofall.RemoveThis@discussions.microsoft.com> wrote in message
> > news:EB82B249-2C94-41E4-83BE-C31308388E0F@microsoft.com...
> > > I wrote an ISAPI filter that collects and modifies the data before sending
> > it
> > > down to the browser, including the images.
> > >
> > > The image shows fine in FireFox, but it's shows the X image marker in IE
> > > instead of the image. When I save the data to a file and open it, I
> > > noticed the image binary is cut off by what I think is a carriage return
> > or
> > > new line character. In my code, I collect the data in the string type in
> > > C++.
> > >
> > > Has anyone experienced this problem? If you have a solution, please let
> > me > know.
> > >
> >
> >
> > It would help if you posted some code, although using a 'string' type to
> > hold binary data doesn't sound too sensible when C++ gives you plenty of
> > other options.
> >
> > --
> > Anthony Jones - MVP ASP/ASP.NET
> >
> >
> >
 >> Stay informed about: Image in FireFox is fine, but not in IE 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting Problem Solving Community! (Home) -> IIS All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]