Uri u = context.Request.UrlReferrer;
//访问来源地址
string ip = context.Request.UserHostAddress;
//访问来源IP
string serverHost = context.Request.Url.Host;
//当前访问主机地址
string localIP=System.Configuration.ConfigurationManager.AppSettings[
"LocalIP"];
if (u ==
null || u.Host.ToLower() != serverHost.ToLower() || ip !=
localIP)
{
context.Response.Write("非本地访问");
}
else
{
context.Response.WriteFile(context.Request.PhysicalPath);
}
转载于:https://www.cnblogs.com/daixingqing/archive/2012/12/11/2813545.html
相关资源:防盗号攻略