Forum  Commercial Foru...  Commercial Foru...  Inconsistent HtmlBox behavior
Previous Previous
 
Next Next
New Post 12/1/2009 8:47 AM
  msawczyn
190 posts
5th Level Poster


Inconsistent HtmlBox behavior 

I have an HtmlBox to which I'm streaming the bytes of a pdf via the form's gateway handler. The relevant code is:

      protected override IGatewayHandler ProcessGatewayRequest(System.Web.HttpContext httpContext, string action)
      {
         switch (action)
         {
            case "Document":
               if (SelectedDocument != null)
               {
                  httpContext.Response.ContentType = SelectedDocument.MimeType;
                  httpContext.Response.BinaryWrite(SelectedDocument.Data);
                  httpContext.Response.End();
               }
               break;
         }

         return null;
      }

When I run this from my local visual studio webserver, the pdf is displayed embedded in the HtmlBox. Yet when this is deployed to IIS, the pdf opens in an instance of Acrobat reader external to the browser. Same code, yet different behavior. The proper mime type is being sent

Any thoughts as to why this is happening? The desired behavior is to have it embedded in the HtmlBox.

Thanks.

-- Michael

 

 

 
New Post 12/1/2009 11:35 AM
  palli
14295 posts
1st Level Poster




Re: Inconsistent HtmlBox behavior 

Hi Michael,

Not sure exactly why, but based on what I can find via Google, this probably is some Browser + WebServer combination that interpretes the headers, or lack of headers, differently.

Try forcing it as inline by adding something like:

                    HttpContext.Response.AddHeader("Content-Disposition", string.Format("inline; filename={0};", Path.GetFileName(strFileName)));

Where you replace the GetFileName function call with what ever fits your needs.

Hope this helps,

Palli


 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 12/1/2009 11:40 AM
  msawczyn
190 posts
5th Level Poster


Re: Inconsistent HtmlBox behavior 

That's all I could find as well -- vague references to interactions. It's certainly true, since the only variable is which server it's on.

Thanks for responding. Hopefully someone has run into this before and remembers which of the three million settings one can change does the trick.

-- Michael

 
New Post 12/1/2009 2:33 PM
  palli
14295 posts
1st Level Poster




Re: Inconsistent HtmlBox behavior 

Hi Michael,

Yes, let's hope someone will remember.

I did find a LOT of communication about incompatibility about the ContentType between browsers, especially when forcing a SaveAs dialog, but not that much about the Content-Disposition.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 12/2/2009 12:39 PM
  msawczyn
190 posts
5th Level Poster


Re: Inconsistent HtmlBox behavior 

To get more eyes on this, I've moved the post to the public forums at this link.

 

 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  Inconsistent HtmlBox behavior
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS