im currently testing the website i created. i used a method of displaying the image through FileStream and BinaryReader (e.g "http://localhost/img.aspx?id=test.jpg"). it works fine actually, but the thing is, everytime i navigate through pages the image reload as well, taking a hit on the page load time.

is there a way to cache the image. so once it's loaded before, it won't stream anymore and will use the cache instead? thanks and hope someone could help me.

7 Years
Discussion Span
Last Post by dnanetwork

r u loading data using .ashx ?

if no then you can cache the querystring...
depend on that it will cache the image..!

put this on the page level..
<@outputcache varybyParam="id" duration="time of your choice">

Edited by dnanetwork: n/a


im loading data via aspx Page Load response. i'll check if this is applicable. will try first :)


still looks the same. the picture still load page after page. :| the code of aspx file is this:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="img.aspx.vb" Inherits="user_img" %>
<%@ OutputCache VaryByParam="id" Duration="3600" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <form id="form1" runat="server">

then on the page load:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.QueryString("id") IsNot Nothing Then
        End If
    End Sub

DisplayImage is the file streamer :)

i did it right? yes?


yes u did right but to check the o/p
you need to enable trace option at page level;

so you can see if the page is cached..!

Edited by dnanetwork: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.