Muestre el archivo de imagen .swf de la base de datos usando el controlador

I'm having a great deal of difficulty here trying to display a .swf image-based file in IE7 using an handler or another means of displaying a binary .swf file (i.e. from a database). Utilizing an HTTP handler(Handler.ashx) I was hoping to navigate to that url and display the .swf image, similar to opening the .swf file utilizing the browser. I simply cannot get this to work...

I have tried many different methods in order to display these values, they are listed below, followed by a snippet of code that is similar to what I am using in my application.

1) When changing the content-disposition value in the header to use an attachment, the .swf file will be saved and can be opened using the browser.

2) When utilizing a .png file with a content type of "image/png" this works perfectly.

public void ProcessRequest (HttpContext context) {

    Byte[] swfFile = File.ReadAllBytes("file.swf");

    context.Response.Buffer = true;
    context.Response.ContentType = "application/x-shockwave-flash";
    context.Response.AddHeader("Content-Disposition", "filename=file.swf");

Cualquier ayuda será muy apreciada, ¡gracias de antemano!

preguntado el 22 de mayo de 12 a las 19:05

how you initialize it on the web page ? Do you have place it inside an object on html page ? Its a flash file, you can not just throw it as it is. -

I tried embedding it into an object and referencing the ashx page in the source, something like this: <object width="400" height="400"><embed src="handler.ashx"></embed></object> -

I would recommend using a request monitor like Fiddler, Charles, etc. to see the response headers for an on-disk .swf; then just duplicate those in your handler. -

1 Respuestas

You code will work perfectly in Chorme browser. But not in IE8, or Firefox 27. Instead of flusing the object directly to the page, have a page with OBJECT tag and call another web page to get the SWF stream.

  1. con la página OBJECT elementos

<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="" width="100%" height="100%" id="myMovieName" > <param name="movie" value="http://PageWhichGivesObjectStream.aspx?id=1"/> <param name="quality" value="high"/> <param name="bgcolor" value="#FFFFFF"/> <param name="play" value="true"/> <param name="loop" value="true"/> <param name="bgcolor" value="#FFFFFF"/> <param name="allowFullScreen" value="true"/> <param name="salign" value="l"/> </object>

  1. Page which gives object stream

    Response.ContentType = "application/x-shockwave-flash" Response.BinaryWrite(FlashObjectBinary) Response.End()

Esto funciona en IE8

respondido 19 mar '14, 05:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.