Agregar dominio a las imágenes

I am developing a .net web application in c#/.net. For images on my site I am using relative paths. However to assist with performance of my site I am looking to introduce cookieless domains for images.

In most situations I can just add the domain to the images.

But in certain scenarios I cant and need to do it at run time. So I am looking at introducing some code to resolve the urls. I have a couple options of doing this.

  1. Method in base page to loop through all the controls, add append the domain to all controls that inherit for System.Web.Ui.Image and append domain if not present.

  2. Or do similar in a http module. (Is this possible)

Will doing the above slow down my site rendering? I dont want this to be counter productive!

Either of the above approaches should work ok for .net controls.

But any ideas how I might append the domain to html img tag and/or any images within my stylesheets? I probably can just set the domains of the img tag in code, but not sure of the stylesheets.

preguntado el 08 de enero de 11 a las 15:01

1 Respuestas

You can consider using Response.Filter too.

Respondido el 08 de enero de 11 a las 18:01

i would definitely use a Response.Filter (Stream)... IMO this is exactly the kind of things a custom filter is made for! :) - Pauli Østerø

Cheers for the response regarding custom streams - which approach is best performance wise? - aficionado

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