C#编写ISAPI筛选器
请问有没有谁写过ISAPI筛选器?
我想实现限制来源网站,,
比如只有从www.xxx.com过来的才能访问我这个网站.
------解决方案--------------------获取客户端IP:
private string GetClientIP()
{
string result = HttpContext.Current.Request.ServerVariables[ "HTTP_X_FORWARDED_FOR "];
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.ServerVariables[ "REMOTE_ADDR "];
}
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.UserHostAddress;
}
return result;
}
------解决方案--------------------可以用httpmodule,或httphandle来实现
------解决方案--------------------想办法传递www.xxx.com这个网址做参数
------解决方案--------------------可以用httpmodule,或httphandle来实现
------解决方案--------------------http://www.microsoft.com/china/MSDN/library/architecture/patterns/esp/ImpInterCEptingFilterInASP.mspx?mfr=true
sorry.