今天應項目的要求做了個防止IE中圖片被下載的東東!
需說不是絕對的,但對於一般人來說來是可以的---個人認為:)
下面來看看實 現個程吧!

1. 前台界面:
防止圖片在WEB頁面上下載_.net

 1防止圖片在WEB頁面上下載_ASP.NET_02<asp:DataList ID="dgClient" Runat="server" RepeatColumns="2">
 2防止圖片在WEB頁面上下載_ASP.NET_02    <ItemStyle Width="50%"></ItemStyle>
 3防止圖片在WEB頁面上下載_ASP.NET_02    <ItemTemplate>
 4防止圖片在WEB頁面上下載_ASP.NET_02        <table>
 5防止圖片在WEB頁面上下載_ASP.NET_02            <tr>
 6防止圖片在WEB頁面上下載_ASP.NET_02                <td>
 7防止圖片在WEB頁面上下載_ASP.NET_02                    <img src='./ShowImage.aspx?PATH=<%# Server.UrlEncode(DataBinder.Eval(Container.DataItem,"DTSmallImage").ToString())%>' border='0' width="133" height="100" />
 8防止圖片在WEB頁面上下載_ASP.NET_02                </td>
 9防止圖片在WEB頁面上下載_ASP.NET_02                <td class="intro0">
10防止圖片在WEB頁面上下載_4s_11防止圖片在WEB頁面上下載_html_12                    <%#DataBinder.Eval(Container.DataItem,"DTTitle"%>
11防止圖片在WEB頁面上下載_ASP.NET_02                    <br>
12防止圖片在WEB頁面上下載_ASP.NET_02                    會員免費下載<br>
13防止圖片在WEB頁面上下載_ASP.NET_02                    >><href='<%#DataBinder.Eval(Container.DataItem,"DTBigImage") %>'>下載1024*768 </a>
14防止圖片在WEB頁面上下載_ASP.NET_02                    <br>
15防止圖片在WEB頁面上下載_ASP.NET_02                    >><href='<%#DataBinder.Eval(Container.DataItem,"DTSmallImage") %>'>下載800*600 </a>
16防止圖片在WEB頁面上下載_ASP.NET_02                    <br>
17防止圖片在WEB頁面上下載_ASP.NET_02                </td>
18防止圖片在WEB頁面上下載_ASP.NET_02            </tr>
19防止圖片在WEB頁面上下載_ASP.NET_02        </table>
20防止圖片在WEB頁面上下載_ASP.NET_02    </ItemTemplate>
21防止圖片在WEB頁面上下載_ASP.NET_02</asp:DataList>

其主要為以下這句代碼:
防止圖片在WEB頁面上下載_ASP.NET_02<img src='./ShowImage.aspx?PATH=<%# Server.UrlEncode(DataBinder.Eval(Container.DataItem,"DTSmallImage").ToString())%>' border='0' />
其上語句是通過ShowImage.aspx文件來緩存輸出圖 片,以達到顯示的只是圖片的影象效果,而不存在其實際圖片.所以在HTML代碼中看到的也只是<img src='./ShowImage.aspx?PATH=2005811184295.jpg' border='0'>,從而因無法獲得圖片路徑而不能下載,當然一般來說截頻可以獲得到對應的圖片,那麼下面看看
我是怎麼防止用戶截頻來 獲得正確的圖片的吧
2.ShowImage.aspx文件的後台代碼
 1防止圖片在WEB頁面上下載_ASP.NET_02string path = Request.QueryString["PATH"];
 2防止圖片在WEB頁面上下載_ASP.NET_02string EArtURL = ConfigurationSettings.AppSettings["EArtURL"];
 3防止圖片在WEB頁面上下載_ASP.NET_02path = EArtURL + "/NetWorkMamage1/DeskTopSmallImages/" +  path;
 4防止圖片在WEB頁面上下載_ASP.NET_02System.Net.WebClient client = new System.Net.WebClient();
 5防止圖片在WEB頁面上下載_ASP.NET_02string ExpFileName = FileLib.GetFileExName(path);
 6防止圖片在WEB頁面上下載_ASP.NET_02string LocalPath = Server.MapPath("./new111." + ExpFileName );
 7防止圖片在WEB頁面上下載_ASP.NET_02if(System.IO.File.Exists(LocalPath))
 8防止圖片在WEB頁面上下載_4s_11防止圖片在WEB頁面上下載_html_12{
 9防止圖片在WEB頁面上下載_4s_34    FileLib.DeleteFile(LocalPath);
10防止圖片在WEB頁面上下載_防盗_35}

11防止圖片在WEB頁面上下載_ASP.NET_02client.DownloadFile(path,LocalPath);
因以上圖片 都是放在其它WEB站台下面,所以采用以上簡單的代碼來保存到
當前站台下面的臨時文件中,圖上為當前目錄下的new111.jpg,因顯示的圖片 是不確定的個數也不確定,所以保存前先刪除掉其下原來的臨時文件,已保正
當前臨時文件為最新的文件
1防止圖片在WEB頁面上下載_ASP.NET_02System.IO.StreamReader reader = new System.IO.StreamReader(LocalPath);
2防止圖片在WEB頁面上下載_ASP.NET_02
3防止圖片在WEB頁面上下載_ASP.NET_02System.IO.Stream stream = reader.BaseStream;
4防止圖片在WEB頁面上下載_ASP.NET_02byte[] bys = new byte[stream.Length];
5防止圖片在WEB頁面上下載_ASP.NET_02stream.Read(bys,0,(int)stream.Length);
6防止圖片在WEB頁面上下載_ASP.NET_02System.IO.MemoryStream memory = new System.IO.MemoryStream(bys,0,(int)stream.Length);
7防止圖片在WEB頁面上下載_ASP.NET_02stream.Close();
如前台所示,因在一個頁面要顯示多個圖片,而臨時文件又 只有一個,如沒
有以上代碼那麼在下載第二個臨時文件時,定會因第一個文件正在使用而無
法保存,怎麼說:大家想想一般緩沖輸出圖片都是將這 個圖片所占的硬盤空
間讀入到內存中再輸出,因現在只存在一個臨時圖片文件,後來的文件確需
要刪除先前的文件以保持最新的操作(即 DataList每次邦定時都會調用ShowImage.aspx文件來顯示當前圖片),但當前文件雙在使用中需無法刪除或
保存,所以本人才采用 以上代碼來創建當前圖片文件的一個備份放入MemoryStream,再結束對實際圖片的調用stream.Close();
1防止圖片在WEB頁面上下載_ASP.NET_02ImagesEntry.ScaleImagesLib scanle = new ImagesEntry.ScaleImagesLib();
2防止圖片在WEB頁面上下載_ASP.NET_02                if(scanle.Create(memory,133,100))
3防止圖片在WEB頁面上下載_4s_11防止圖片在WEB頁面上下載_html_12                {
4防止圖片在WEB頁面上下載_4s_34                    scanle.Show();
5防止圖片在WEB頁面上下載_防盗_35                }

6防止圖片在WEB頁面上下載_ASP.NET_02                if(scanle.LastError!=null)
7防止圖片在WEB頁面上下載_4s_11防止圖片在WEB頁面上下載_html_12                {
8防止圖片在WEB頁面上下載_4s_34                    //輸出出錯圖片
9防止圖片在WEB頁面上下載_防盗_35                }

以上代碼是對圖片對進縮放處理
還可以對要顯示的圖片加上透明,水印,模糊處理等等,總之能讓其截頻出
也達不到實際的效果。

以 上是偶的一定愚見   

      還望大多多指正:)