ASP.NET防盗链技术
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
if (context.Request.UrlReferrer.Host == "10.11.43.52")
{
context.Response.Expires = 0;
context.Response.Clear();
context.Response.ContentType = "image/jpg";
context.Response.WriteFile(context.Request.PhysicalPath);
context.Response.End();
}
else
{
context.Response.Expires = 0;
context.Response.Clear();
context.Response.ContentType = "image/jpg";
context.Response.WriteFile(context.Request.PhysicalApplicationPath+"error.jpg");
context.Response.End();
}
}
public bool IsReusable {
get {
return true;
}
}
}
1、一般处理程序文件(VS2008下可以直接编译通过),如果是VS2005,则须写入App_code然后进行编译
using Syste
相关文档:
一、认识Web.config文件
Web.config文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过VB.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的
&nb ......
开发平台:
WinXP SP3+IIS5.1+IE7+Visual Studio 2005+Visual Studio 6.0+ MS SOAP Toolkit 3.0
一.创建ASP.NET WebService
Visual Studio 2005à文件à新建à网站àASP.NET Web服务项目WebServiceDemo。
以下为Service.cs代码清单:
// WebService.cs
using System;
using System ......
ASP.NET 2.0服务器控件开发----控件生命周期
服务器控件生命周期简介
服务器控件的生命周期是创建服务器控件最重要的概念。作为开发人员,必须对服务器控件生命周期深刻理解。当然,这不是一朝一夕就可以做到的。对于学习控件开发技术的初学者,可以不必掌握得非常详细深入,只需对服务器控件的生命周期中的不同 ......
第一种:需要引用com :microsoft.excel.11.0.
//生成Excel文件的代码
protected void ExportExcel()
{
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wb = excel.Workbo ......