惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
S
Securelist
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
Cyberwarzone
Cyberwarzone
Cisco Talos Blog
Cisco Talos Blog
量子位
博客园 - Franky
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
T
Troy Hunt's Blog
N
News | PayPal Newsroom
Google Online Security Blog
Google Online Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
N
Netflix TechBlog - Medium
小众软件
小众软件
P
Palo Alto Networks Blog
Spread Privacy
Spread Privacy
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
L
Lohrmann on Cybersecurity
L
LINUX DO - 最新话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Last Watchdog
The Last Watchdog
S
Security @ Cisco Blogs
P
Privacy International News Feed
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
博客园_首页
云风的 BLOG
云风的 BLOG
V
Vulnerabilities – Threatpost
D
DataBreaches.Net
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
罗磊的独立博客
Engineering at Meta
Engineering at Meta
Forbes - Security
Forbes - Security
T
Tenable Blog

博客园 - cncxz(虫虫)

在.NET环境下为网站增加IP过滤功能 推荐几个基于.net的cms系统 超赞的10个Windows Live Writer插件 发布ASP.NET应用程序时的10个好习惯(转) 一个基于web的pdf浏览器 jQuery UI 1.0 已于2007-9-16日正式发布 Visual Studio插件大搜索(60+) 推荐一批基于web的开源html文本编辑器(40+) 终结IE6下背景图片闪烁问题 一个web应用程序统计在线用户列表的东东(带c#源码) 中了网络流氓www.e-jok.cn的招 使用 javascript 标记高亮关键词 Div+Css酷站一箩筐 在win2k3上使用卡巴斯基6.0 发布控件Express.NET.WindowsForms运行时的本地化补丁 创建为ClickOnce清单签名的.pfx格式数字证书 Windows Live Messenger去广告补丁 一个阴历阳历互相转化的类(c#源码) 小发现:sql2005中的异常处理消息框可以直接使用
ajax跨域访问代理文件下载(asp、php、asp.net)
cncxz(虫虫) · 2008-01-23 · via 博客园 - cncxz(虫虫)

最近做东西遇到了ajax跨域(cross domain)访问的问题,最后采用了Application Proxies 方式解决,即在本域内放置一个代理文件(视本域支持的开发语言选定asp、asp.net或是其他),此代理文件将url参数(QueryString)发送到目标域对应页面获取html代码,然后输出。ajax直接访问这个代理文件以达到跨域的目的。
基于asp.net的跨域访问代理文件c#代码如下:

<%@ Page Language="C#" AutoEventWireup="true"  ResponseEncoding="utf-8" %>
<%@ Import Namespace=System.Net %>
<%@ Import Namespace=System.IO %>

<script runat="server">
    
protected override void OnLoad(EventArgs e)
    
{
        
base.OnLoad(e);

        
string sourceUrl = "http://devspy.net";
        
this.Page.Response.Write(TransferHtmlPage(string.Concat(sourceUrl, "?"this.Page.Request.QueryString)));
    }

    
    
public string TransferHtmlPage(string url)
    
{
        
string result = string.Empty;
        
try
        
{            
            HttpWebRequest request 
= (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse response 
= (HttpWebResponse)request.GetResponse();
            StreamReader reader 
= new StreamReader(response.GetResponseStream(), Encoding.UTF8);
            result 
= reader.ReadToEnd();
        }

        
catch(Exception ex)
        
{
            
return string.Format(@"<p style='color:red;text-align:center;'>服务器获取文件内容出错:{0}</p>", ex.Message);
        }


        
if (!CheckVersionWaterMark(result))
            
return @"<p style='color:red;text-align:center;'>版本水印失效,请联系相关技术人员。</p>";
        
        
return result;
    }

    
    
public bool CheckVersionWaterMark(string inputString)
    
{
        
return true;//不验证水印了
        
//string pattern = "WaterMark";
        
//return Regex.IsMatch(inputString, pattern, RegexOptions.IgnoreCase);
    }


</script>


另外还有基于asp和php的实现,不再列出,感兴趣的可以下载包含这三个文件的压缩包:
https://files.cnblogs.com/cncxz/ajaxProxy.rar