根据IIS / Sharepoint服务器中的请求标头允许/阻止传入请求

时间:2012-07-22 04:26:02

标签: iis-7 sharepoint-2010 http-headers

我在IIS 7.5上运行了sharepoint站点。我想根据请求标头允许/阻止传入请求。这是我想要实现的条件

这里clientId和userAgent是请求标题。

String clientId=Request.getHeaderValue('clientID');
String userAgent=Request.getHeaderValue('useragent');

//If clientId and userAgent are empty abort the request

 if(clientId.equals('') && userAgent.equals('')){

//Abort the request
} 

//If clientId is not empty but is not matching my expected value,then abort the    request.
if(!clientId.equals('') && !clientId.equals('1234'){

//Abort the request
}

//If userAgent is not matching my expected value ,then abort the request.
if(!userAgent.equals('myfavbroswer')){

//Abort the request

}

我已经看过IIS中的URLRewriteModule。它似乎没有达到我的目的。

这是我想要实施的粗略逻辑。我是IIS服务器和sharepoint的新手。可以告诉我在哪里可以将这个逻辑用于服务器的目的。

感谢。

1 个答案:

答案 0 :(得分:0)

URLRewrite实际上是为了我的目的。你只需要知道如何使用它。我只需要以不同的方式编写我的条件。它允许你做出你想要的任何条件。只是有点令人困惑的事情开头。如果你知道regexp那么它就成了一个非常好的模块。

编辑:此视频让您非常了解如何实现这一目标。 http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-video-walkthrough