图片站怎么防止非注册会员看 一个图片站,用户要点数来看图.怎样防止用户用flashget等工具或知道真图的路径后直接打图的网址看,请帮说一个解决方案,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以采用图片防盗链这里有很多源代码http://www.google.com/search?hl=zh-CN&q=asp.net+%E9%98%B2%E7%9B%97%E9%93%BE&lr= 这个 需要你 把真实的 图片地址隐藏掉使用一个专门的 loadpic.aspx文件 来 读取真实图片并输出在这个文件里面 即可判断用户权限. 可把图片放在虚拟目录之外的地方.用一个专门的页面.判断权限后通过writeFile的方式输出. 自己写一个专门对图片的http处理程序吧 用HttpModule过滤请求,例如你用Forms验证的话就用同样的验证来过滤请求。 你在webconfig文件里设置下不允许匿名用户浏览不就可以了. 在以前公司时候做的可以实现楼主需要 loadpic.aspx<%@ Page language="c#" Codebehind="loadpic.aspx.cs" AutoEventWireup="false" Inherits="Wireless_Album.loadpic" codePage="936"%>loadpic.aspx.csusing System;using System.Collections;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Drawing.Imaging;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.IO;using joyesDB.Security;namespace Wireless_Album{ /// <summary> /// loadpic 的摘要说明。 /// </summary> public class loadpic : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { //const int MaxLength=150; //最大长度 //imgsrc(); if (Request.QueryString["key"]==null || Request.QueryString["key"]==string.Empty) { Response.Redirect("index.aspx",true); } else { //取得原图 string filename=Server.UrlDecode(Request.QueryString["key"]); Des sc=new Des(); //Response.Write("<script>alert('"+filename +"');</script>"); filename=sc.Decrypt(filename,"joyescom"); //Response.Write("<script>document.write('"+filename +"');</script>"); Bitmap bmpOld= new Bitmap(Server.MapPath(filename)); Response.Clear(); //输出图片 bmpOld.Save(Response.OutputStream, ImageFormat.Jpeg); bmpOld.Dispose(); Response.End(); } } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion }}//两两前的代码...使用页面<img src="http://photo.joyes.com/loadpic.aspx?key=0B7BAAD210D2EB3E&s=big" alt="loading" />//这里的key由后台取出的实际地址 用des可逆算法加密效果可以看看 http://photo.joyes.com/loadpic.aspx?key=0B7BAAD210D2EB3E&s=big 但我认为每次都要创建Bitmap可能性能就将会有所下降啊! 【急】fckeditor 2.6.4.1上传图片问题! Application和Session的区别 获取包含页面的URL 超超超超超级简单问题!在线等,解决立马给分! 现金求购.NET的购物网站. 关于写入Excel文件的问题 郁闷那~ 操作符丢失 flash 动画按钮怎样进超链接? "转换为数据类型为 int 的列时发生语法错误" 和 "列名无效" excel导入数据库权限问题 超级郁闷的问题,高手解答下,100分 .net framework安装时出现2721错误
这里有很多源代码http://www.google.com/search?hl=zh-CN&q=asp.net+%E9%98%B2%E7%9B%97%E9%93%BE&lr=
把真实的 图片地址隐藏掉使用一个专门的 loadpic.aspx文件 来 读取真实图片
并输出在这个文件里面 即可判断用户权限.
可以实现楼主需要 loadpic.aspx
<%@ Page language="c#" Codebehind="loadpic.aspx.cs" AutoEventWireup="false" Inherits="Wireless_Album.loadpic" codePage="936"%>
loadpic.aspx.csusing System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;using joyesDB.Security;namespace Wireless_Album
{
/// <summary>
/// loadpic 的摘要说明。
/// </summary>
public class loadpic : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
//const int MaxLength=150; //最大长度
//imgsrc();
if (Request.QueryString["key"]==null || Request.QueryString["key"]==string.Empty)
{
Response.Redirect("index.aspx",true);
}
else
{
//取得原图
string filename=Server.UrlDecode(Request.QueryString["key"]);
Des sc=new Des();
//Response.Write("<script>alert('"+filename +"');</script>");
filename=sc.Decrypt(filename,"joyescom");
//Response.Write("<script>document.write('"+filename +"');</script>");
Bitmap bmpOld= new Bitmap(Server.MapPath(filename));
Response.Clear();
//输出图片
bmpOld.Save(Response.OutputStream, ImageFormat.Jpeg);
bmpOld.Dispose();
Response.End();
}
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}
//两两前的代码...
使用页面
<img src="http://photo.joyes.com/loadpic.aspx?key=0B7BAAD210D2EB3E&s=big" alt="loading" />
//这里的key由后台取出的实际地址 用des可逆算法加密效果可以看看 http://photo.joyes.com/loadpic.aspx?key=0B7BAAD210D2EB3E&s=big