» Publishers, Monetize your RSS feeds with FeedShow: More infos (Show/Hide Ads)
一份出版社读者调查,临时发布,敬请谅解啊。
Web应用防火墙(WAF,Web Application Firewall)读者调查问卷
http://www.itenable.com.cn/enableq/q.php?qname=diaocha_3823
帮助朋友做的一个问卷调查,有空帮忙参与一下,谢谢!
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- 关于创建自定义Service Application的胡言乱语
- 反编译Silverlight应用
- SharePoint Server 2007 的一个问题
- Margin 属性的一些边界情况说明
- SharePoint 2010 新体验6 - 开发人员面板
- Silverlight学习笔记--多媒体
- 我的欧洲演讲 (2009年12月)
- SharePoint 2010 新体验5 - Office Web Applications
- SharePoint 2010 新体验4 - SharePoint Workspace
- SharePoint 2010 新体验3 - 文档集
SQL Server 2008 SP以及累计更新包之间的关系还真的有点乱。
SQL Server 2008 SP1刚刚发布,现在没几天出来一个CU1 for SP1。
目前的这个CU1是将之前SQL Server 2008 CU4的Hotfix补漏到了SQL Server 2008 SP1当中,因为在SQL Server 2008 SP1中并不包含SQL Server 2008 CU4的所有Hotfix。
因为按照微软的说法,SQL Server 2008 SP1与CU4 for SQL Server 2008 RTM只重叠6个hotfix ,参见http://blogs.msdn.com/psssql/archive/2009/04/09/sql-server-2008-sp1-and-cumulative-updates-explained.aspx。
(http://support.microsoft.com/kb/962900/ )
FIX: Error message when you run a query that involves an outer join operation in SQL Server 2008: "Attempting to set a non-NULL-able column's value to NULL"
(http://support.microsoft.com/kb/968693/ )
FIX: A query that uses parameters and the RECOMPILE option returns incorrect result when it is run in multiple connections concurrently in SQL Server 2008
(http://support.microsoft.com/kb/963070/ )
FIX: You cannot edit or debug a SSIS package in BIDS when SQL Server 2008 Enterprise Edition, Standard Edition, Developer Edition or Evaluation edition is installed without the SSIS feature.
(http://support.microsoft.com/kb/961633/ )
FIX: A SQL Server 2008 Reporting Services report is displayed incorrectly in Mozilla Firefox if the report is displayed by using the ReportViewer control
(http://support.microsoft.com/kb/963658/ )
FIX: PAGE compression is removed from a SQL Server 2008 data table after you shrink the database
(http://support.microsoft.com/kb/967470/ )
FIX: Error message when you perform an update or a delete operation on the table that does not have a clustered index created in SQL Server 2008: "The operating system returned error 1450"
也就是说,如果你更新到CU4 for SQL Server 2008 RTM是为了解决上面6个问题中的某个,那么你更新SQL Server 2008 SP1之后,这些hotfix仍然有效,但如果你更新CU4 for SQL 2008 RTM是因为其他的hotfix,那么请不要更新SP1。
是不是有点绕,简单点来说,微软这么做是为了那些一直持续进行SQL Server 2008 CU1 / CU2 / CU3 / CU 4更新上来的那些同志们服务的。
SQL Server 2008 SP1就是包含了SQL Server 2008 CU1/CU2/CU3的Hotfix(也包含6个CU4 hotfix)。
SQL Server 2008 SP1:
SQL Server 2008 Service Pack 1 Cumulative Update 1下载地址:
http://support.microsoft.com/kb/969099/en-us
SQL Server 2008 RTM之后的Build版本变化:
http://support.microsoft.com/kb/956909/en-us
更清晰点可以看这幅图:
(点击上图可以看大图)
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
很不错的一份演示PPT,详细介绍了如何在IIS7下利用HttpModule来实现一个完整的WAF产品,其中很多特性值得借鉴和学习,不妨仔细看看。
IIS7是一个充分借鉴了Apache的优秀模块化设计思想的产物,虽然在ASP.NET设计之初就有HttpModule/HttpHandle的概念,但是那时候的.NET HttpModule/HttpHandle只能捕获以及处理ASP.NET的请求,而针对于同样将IIS作为宿主的其他Http Request则只能干瞪眼,比如PHP/ASP。
在以前的IIS5.x/IIS 6下面,如果要开发一个完整的Web Application Firewall子集,则必须写ISAPI Filter。而ISAPI在不同的IIS版本下都有诸多限制。比如说:在IIS 5.x下,ISAPI Filter可以轻松捕获以及处理GET和POST数据,但是到了IIS6下面则很难捕获到POST数据,当然在IIS6下是同样可以捕获处理POST数据的,只是难度要远大于IIS5.x,需要利用通配符ISAPI Extend来迂回处理,或者启用IIS6的向下兼容模式(这也完全失去了IIS6的优势所在了)。
而在IIS5.x /IIS6下编写ISAPI Filter则在很长一段时间内都没有C#的份儿,原因很简单,C#之类的IL语言是不能直接来编写ISAPI Filter的,只能用VC/Delphi之类的来写ISAPI。不过使用C#还是可以开发ISAPI的,只是同样适用迂回策略即可,:) 。 这一点就连微软IIS Team竟然也在blog上不可行,不过后面我来告诉大家如何用C#来实现ISAPI Filter。
现在IIS7则完全提供了对于.NET的原生支持,也就是说我们可以用.NET Httpmodule/HttpHandle来捕获处理所有进站/出站的Request/Response,从而得以可以使用.NET完整控制整个Web Server的请求过程。
同时IIS7也提供了重写的原生C++支持。
从上面可以总结出来,IIS7.0下的Module/Handle可以通过.NET以及C++两种方式来编写,如果说两者之间有什么差异的话,那当然是原生的C++能处理的粒度更细微以及性能更好,总体上来说,差异并不大。
微软也建议在IIS7下不要再编写ISAPI,因为Module/Handle设计的架构更完备,他就是用来取代历史的ISAPI Filter以及ISAPI Extend的。不过有意思的是,URLScan 3.x版本竟然还是一个ISAPI,:) 。
Protecting Vulnerable Applications with IIS7
• Overview
• IIS7 Integrated Mode
• IIS7 Modules
– Request Filtering Module
– Add-on Modules (from Microsoft)
– Custom Modules
– Case Study: SPF
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
WAF中的一个特性就是要阻止各类的XSS攻击以及CSRF攻击,尤其是后者,一般的WAF解决方案是针对GET以及POST插入随机身份令牌的做法,这样做的目的就是辨别出来经过伪造的跨站请求提交。
对于GET而言,WAF需要在受保护的URL连接后面动态插入随机令牌,比如这两个对比站点:http://trade-spf.gdsdemo.com/ 以及 http://trade-no-spf.gdsdemo.com/ ,前者是受保护的测试站点,后者则没有收到任何保护。
对于POST而言,也是类似的做法,WAF通过合理的令牌构造,可以比较有效的保护表单数据以及ASP.NET VIEWSTATE数据。
设计一个完备的令牌机制,可以有效的做到保护如下几个方面:
- 保护URL数据 (/ShowArticle.aspx?ArticleId=123&UrlToken=182734:A7A9369D50B2E185F54A)
- 保护HTML FORM表单数据 (<input type ="hidden" name="FormToken" value="3F2504E0-4F89-11D3-9A0C-0305E82C3301">)
- 抵御CRSF (/ShowArticle.aspx?ArticleId=123&UrlToken=182734:A7A9369D50B2E185F54A)
- 保护Javascript
<a href="javascript:__doPostBack('ctl00$MainContent$gvwThreads'
,'Sort$LastPostDate')">进化为
<a href="javascript:__doPostBack('b/xEVUeEDOCnhiKu0jS5USUs6N
4Qu1VH5OqHOwF146wSPlA87g==:1829384:61D26FD0849FF93D67B8489C4Qu1VH5OqHOwF146wSPlA87g==:61D26FD0849FF93D67B8489CF
A76','b/xEVUeEDOBfdZR3UM0Ds212HDDwHY3KoYyc/+/JULiDcjQ=:1829384:
83BF9D18B5C34CE2FC0541F954C093B43F0C3EA5')">
有关这方面的东西,后面再慢慢讨论.
下面这篇blog是讨论如何通过ASP.NET MVC的AntiForgeryToken helpers来保护POST数据,可以参考下。
Prevent Cross-Site Request Forgery (CSRF) using ASP.NET MVC’s AntiForgeryToken() helper
Update: Since the Release Candidate of ASP.NET MVC, these anti-forgery helpers have been promoted to be included in the core ASP.NET MVC package (and not in the Futures assembly).
Cross-site scripting (XSS) is widely regarded as the number one security issue on the web. But since XSS gets all the limelight, few developers pay much attention to another form of attack that’s equally destructive and potentially far easier to exploit. Your application can be vulnerable to cross-site request forgery (CSRF) attacks not because you the developer did something wrong (as in, failing to encode outputs leads to XSS), but simply because of how the whole Web is designed to work. Scary!
How CSRF works
So, what’s it all about? All web application platforms are potentially vulnerable to CSRF, but in this post I’ll focus on ASP.NET MVC. Imagine you have a controller class as follows:
public class UserProfileController : Controller { public ViewResult Edit() { return View(); } public ViewResult SubmitUpdate() { // Get the user's existing profile data (implementation omitted) ProfileData profile = GetLoggedInUserProfile(); // Update the user object profile.EmailAddress = Request.Form["email"]; profile.FavoriteHobby = Request.Form["hobby"]; SaveUserProfile(profile); ViewData["message"] = "Your profile was updated."; return View(); } }This is all very normal. First, the visitor goes to Edit(), which renders some form to let them change their user profile details. Secondly, they post that form to SubmitUpdate(), which saves the changes to their profile record in the database. There’s no XSS vulnerability here. Everything’s fine, right? We implement this sort of thing all the time…
Unfortunately, this innocent controller is an easy target for CSRF. Imagine that an attacker sets up the following HTML page and hosts it on some server of their own:
<body onload="document.getElementById('fm1').submit()"> <form id="fm1" action="http://yoursite/UserProfile/SubmitUpdate" method="post"> <input name="email" value="hacker@somewhere.evil" /> <input name="hobby" value="Defacing websites" /> </form> </body>Next, they somehow persuade a victim to visit this page (basic social engineering, look it up). When this HTML page loads, it submits a valid form post to /UserProfile/SubmitUpdate on your server.
Assuming you’re using Windows authentication or some kind of cookie-based authentication system such as Forms Authentication, the automated form post will be processed within the victim’s established authentication context, and will successfully update the victim’s email address to something under the attacker’s control. All the attacker has to do now is use your “forgotten password” facility, and they’re taken control of the victim’s account.
Of course, instead of changing an victim’s email address, they can perform any action that the victim can perform with a single POST request. For example, they might be able to grant administrative permissions to another account, or post something defamatory to a CMS.
Ways to stop CSRF
There are two main ways to block CSRF:
- Check that incoming requests have a Referer header referencing your domain. This will stop requests unwittingly submitted from a third-party domain. However, some people disable their browser’s Referer header for privacy reasons, and attackers can sometimes spoof that header if the victim has certain versions of Adobe Flash installed. This is a weak solution.
- Put a user-specific token as a hidden field in legitimate forms, and check that the right value was submitted. If, for example, this token is the user’s password, then a third-party can’t forge a valid form post, because they don’t know each user’s password. However, don’t expose the user’s password this way: Instead, it’s better to use some random value (such as a GUID) which you’ve stored in the visitor’s Session collection or into a Cookie.
Using the AntiForgeryToken helpers
With Preview 5, Microsoft has added a set of helpers to the “futures” assembly, Microsoft.Web.Mvc.dll,The core ASP.NET MVC package includes a set of helpers that give you a means to detect and block CSRF using the “user-specific tokens” technique.To use these helpers to protect a particular form, put an Html.AntiForgeryToken() into the form, e.g.,
<% using(Html.Form("UserProfile", "SubmitUpdate")) { %> <%= Html.AntiForgeryToken() %> <!-- rest of form goes here --> <% } %>This will output something like the following:
<form action="/UserProfile/SubmitUpdate" method="post"> <input name="__RequestVerificationToken" type="hidden" value="saTFWpkKN0BYazFtN6c4YbZAmsEwG0srqlUqqloi/fVgeV2ciIFVmelvzwRZpArs" /> <!-- rest of form goes here --> </form>At the same time, Html.AntiForgeryToken() will give the visitor a cookie called __RequestVerificationToken, with the same value as the random hidden value shown above.
Next, to validate an incoming form post, add the [ValidateAntiForgeryToken] filter to your target action method. For example,
[ValidateAntiForgeryToken] public ViewResult SubmitUpdate() { // ... etc }This is an authorization filter that checks that:
- The incoming request has a cookie called __RequestVerificationToken
- The incoming request has a Request.Form entry called __RequestVerificationToken
- These cookie and Request.Form values match
Assuming all is well, the request goes through as normal. But if not, boom!, there’s an authorization failure with message “A required anti-forgery token was not supplied or was invalid”.
This prevents CSRF because even if a potential victim has an __RequestVerificationToken cookie, an attacker can’t find out its value, so they can’t forge a valid form post with the same value in Request.Form. But legitimate users aren’t inconvenienced at all; the mechanism is totally silent.
Using salt
Salt? What? In case you want to protect multiple forms in your application independently of each other, you can use a “salt” value when you call Html.AntiForgeryToken(), e.g.,
<%= Html.AntiForgeryToken("someArbitraryString") %>… and also in [ValidateAntiForgeryToken], e.g.,
[ValidateAntiForgeryToken(Salt="someArbitraryString")] public ViewResult SubmitUpdate() { // ... etc }Salt is just an arbitrary string. A different salt value means a different anti-forgery token will be generated. This means that even if an attacker manages to get hold of a valid token somehow, they can’t reuse it in other parts of the application where a different salt value is required. (If anyone can suggest other use cases for salt, please let me know.)
Limitations of the Anti-Forgery helpers
ASP.NET MVC’s anti-CSRF helpers work very nicely, but you should be aware of a few limitations:
- All legitimate visitors must accept cookies (otherwise, [ValidateAntiForgeryToken] will deny their form posts). Arguably this isn’t a limitation, because unless visitors allow cookies, you probably don’t have anything to protect anyway.
- It only works with POST requests, not GET requests. Arguably this isn’t a limitation, because under the normal HTTP conventions, you shouldn’t be using GET requests for anything other than read-only operations.
- It’s easily bypassed if you have any XSS holes on your domain. An XSS hole would allow an attacker to read a victim’s anti-forgery token value, then use it to forge valid posts. So, don’t have XSS holes!
- It relies on the potential victim’s browser implementing cross-domain boundaries solidly. Browsers are supposed to stop foreign domains from reading your app’s response text and cookies, and are supposed to stop foreign domains from writing cookies to your domain. If an attacker manages to find a way around this, they can bypass [ValidateAntiForgeryToken]. Of course that’s not supposed to be possible. For the most part, modern browsers block this line of attack.
In conclusion, ASP.NET MVC’s anti-CSRF helpers are easy to use, and work very nicely thank you!
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
AppScan是一款很不错的Web安全扫描工具,对于检测网站安全,进行安全稽核审计有很大帮助,从WatchFire Appscan 7.0就开始使用了,一直到现在。
不过任何一款安全扫描工具都存在一些误判,AppScan同样如此。最近在对一家证券公司进行安全评估时候,appscan就出现较多误判,如何剔除误判的条目,就需要你仔细分析appscan给出的Request/Response内容了。
这一次的7.8.1终于提供了多国语言支持,其中也包含了简体中文,的确是一个很好的选择。在商业安全扫描工具中,提供简体中文支持的,目前也只有AppScan一个。之所以比较关心appscan的简体中文,是因为appscan在每次扫描到漏洞后,会给出相应的java/.net/php等的解决方案,洋洋洒洒一大片,虽然英文不是太大问题,不过都给出来中文当然最好了。
另外2个比较好的Web安全审计工具分别是Acunetix Web Vulnerability Scanner以及HP Webinspect,同样可以在其主页上下载到相关版本。
目前能够下载到的为Test版本,Standard版本,Developer版本,以及Build版本。IBM网站没有提供Enterprise版本的下载
Build版本是可以与Rational Application Developer以及Eclipse进行集成的。
安装过程中需要注意的,初始启动安装的时候,要检查IBM Installtion Manager的最新版本,安装包里面的是1.2.1,需要更新到最新版本,否则安装失败(我在Windows Server 2008上是如此)。
一路按照需求进行选择,即可:
IBM Rational AppScan Developer/Build Edition V7.8.1 安装包
IBM Rational AppScan Developer Edition 7.8 for Rational Application Developer 7.0/Eclipse 3.2 Windows Evaluation Multilingual Part 1
CZ122ML.zip (592 MB)
http://www15.software.ibm.com/sdfdl/v2/fulfill/CZ122ML/Xa.2/Xb.aq9Tc4a86B22iy0SonsK7xETExEVsWlsdCJ8xY8/Xc.CZ122ML/CZ122ML.zip/Xd./Xf.LPr.A6VN/Xg.4876199/Xi.RATLe-APPSCANDE-EVAL/XY.regsrvs/XZ.9WheiV-ai_5HsH5goLk8KutFYx0/CZ122ML.zip
IBM Rational AppScan Developer Edition 7.8 for Rational Application Developer 7.0/Eclipse 3.2 Windows Evaluation Multilingual Part 2
CZ123ML.zip (20 MB)
http://www15.software.ibm.com/sdfdl/v2/fulfill/CZ123ML/Xa.2/Xb.aq9Tc4a86B22iy0SonsK7xETExEVsWlsdCJ8xY8/Xc.CZ123ML/CZ123ML.zip/Xd./Xf.LPr.A6VN/Xg.4876199/Xi.RATLe-APPSCANDE-EVAL/XY.regsrvs/XZ.j3X1NMrz7yQySOco_0qbe1d725w/CZ123ML.zip
IBM Rational AppScan Developer Edition 7.8 for Rational Application Developer 7.5/Eclipse 3.4 Windows Evaluation Multilingual Part 1
CZ124ML.zip (496 MB)
http://www15.software.ibm.com/sdfdl/v2/fulfill/CZ124ML/Xa.2/Xb.aq9Tc4a86B224a3C6AODtb3q-gwRosaPn3uTIRo/Xc.CZ124ML/CZ124ML.zip/Xd./Xf.LPr.A6VN/Xg.4875928/Xi.RATLe-APPSCANDE-EVAL/XY.regsrvs/XZ.c0PFnNWHiOjyASAT4Vi8LhPzgV0/CZ124ML.zip
IBM Rational AppScan Developer Edition 7.8 for Rational Application Developer 7.5/Eclipse 3.4 Windows Evaluation Multilingual Part 2
CZ125ML.zip (249 MB)
http://www15.software.ibm.com/sdfdl/v2/fulfill/CZ125ML/Xa.2/Xb.aq9Tc4a86B224a3C6AODtb3q-gwRosaPn3uTIRo/Xc.CZ125ML/CZ125ML.zip/Xd./Xf.LPr.A6VN/Xg.4875928/Xi.RATLe-APPSCANDE-EVAL/XY.regsrvs/XZ.hSIf5Pyz287S-qOG0Ja64TYJsMc/CZ125ML.zip
IBM Rational License Server Windows V7.1 Multilingual English Eval
C1ST1ML.zip (88 MB)
http://www15.software.ibm.com/sdfdl/v2/fulfill/C1ST1ML/Xa.2/Xb.aq9Tc4a86B22iy0SonsK7xETExEVsWlsdIGTLR4/Xc.C1ST1ML/C1ST1ML.zip/Xd./Xf.LPr.D1VK/Xg.4876199/Xi.RATLe-APPSCANDE-EVAL/XY.regsrvs/XZ.aMiwSY2lWh6BQprQolM6lMA6f_4/C1ST1ML.zip
IBM Rational AppScan Standard Edition V7.8.1 安装包
备注:如果要扫描Web Services,则必须安装AppScan的Web Services组件 :
IBM Rational Web Services Explorer (add-on to AppScan Standard Edition 7.8)
CZ25ZML.exe (263 MB)
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
树状报表是比较常见的一类报表,从开发角度来看,其实就是添加了若干分组的报表,通过某些字段的group,把一些数据聚集到一起,使得终端用户能够得到比较直观的数据,RS提供可折叠的树状属性,方便我们做出漂亮的折叠报表。
下面就来演示其做法。
数据源为:
select 'A' as Supplier,2008 as year,1 as month, 9 as Revenue
union select 'A' as Supplier,2007,5,9
union select 'A' as Supplier,2008,3,9
union select 'A' as Supplier,2008,2,9
union select 'B' as Supplier,2008,2,9
union select 'C' as Supplier,2008,2,9
返回的数据:
画出简单的layout,其中添加3个分组,分别是Supplier,Year和Month,如图
添加分组之后,分别在groupheader中加入数据,加入数据之后的报表为
设置图中的第一个分组中的第一个单元格的名字为Supplier,第二个分组中的第二个单元格名字为year,第三个分组中的第三个单元格的名字为Month,如下图:
全部设置完之后,选择第三行,点击属性
打开属性设置后,点开Visibility,设置Hidden为true,ToggleItem中选择Supplier
设置第四行
设置最后一行
设置完毕,最后的可折叠图为:
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
报表开发的时候,常常会有summary的报表及其detail的报表,我们希望能够两张报表对比看数据,在看到summary里面的某条数据的时候,我们希望能够立刻看到其详细的信息。这个时候,如果再去打开detail报表,输入参数,查看数据,实在是很麻烦,尤其是遇到下一条summary的数据,又要重新来过一遍,很不方便,这个时候,我们可以试着用一下RS提供的功能:Jump to report。
首先我们新建两张报表
SummaryReport:
数据源:
报表(全图):
DetailReport:
数据源:
首先,我们要给DetailReport添加一个参数
在报表的data页面,添加dataset代码:
select * from (select 'A' as Supplier,9 as Revenue,1 as Deposit
union select 'B' as Supplier,6,2
union select 'C' as Supplier,7,6)t
where t.Supplier in (@Supplier)
刷新这段代码,得到参数,打开dataset页面,选择Parameters,可以看到参数已经被加进去,如图:
报表成图为(输入参数A):
下面我们来给两张报表添加关联。
打开报表SummaryReport的设计页面,右键点击要添加关联的列数据,选择属性
打开属性选项卡,选择Navigation设置,在Hyperlink action下选择Jump to report,同时选择要jump到的报表的名称
点击报表名称输入框右边的按钮Parameters,输入两个报表关联的参数,在我们的示例中,关联参数为Fields!Supplier.Value。
其中,左边的Parameter Name为detailReport的参数,右边的为summaryReport的。
设置完毕,在Summary Report中点击不同的Supplier名称,则会跳到不同的Detail报表。
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
RS提供在页面上添加排序,使得前端用户能够根据自己的需要,来设置排序方式。下面简单演示一下添加交互式排序的方法。
Dataset传回的数据为:
简单的报表制作:
其中sales的计算公式为Revenue + Deposit
下面添加排序,首先,在要添加排序的列的table header上右键单击属性,如下图:
在属性编辑框中选择交互式排序,输入排序的字段和范围
可以通过排序表达式(上图的第二部分)和选择数据区域或组(上图的第三部分)来设置需要排序的范围和排序大小的评估(排序是否涉及组内的细节),由于我们没有设置分组,因为不演示这两个功能。
由计算得来的数据列分组只需在排序表达式中设置公式即可,如下:
也可点击后面的fx按钮,进行复杂的计算。
在每一列都加上排序之后,我们来看看效果:
如图,单击列名旁边的上下箭头按钮即可以对报表的数据进行重新排列。
同时,因为这个地方的排序是对报表内的数据集进行排序,不会重新访问数据库,所以,这些操作不会影响到报表的性能。
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
SQL注入算是一个极为普通的问题了,解决方案也多如牛毛,但是新的注入方式仍然层出不穷。
目前很多IIS防火墙其实质就是一个ISAPI Filter,针对SQL注入攻击的防御实质就是关键字过滤,这一点在我以前的随笔中提到的在开发的Web Server Guard中也是这样操作的。但目前大部分的IIS防火墙都存在一个漏洞:如果关键字包含未转义百分比符号 (%) ,那么将会绕过这些IIS防火墙的请求过滤和拦截,包含IIS 7.0的Request Filter。
因为这类防火墙都是查找位于URL/Form/Cookie中的关键字,比如Exec。但是如果你传入E%xec,那么将不会被过滤,这个问题在目前已知的大部分IIS防火墙(具体的就不介绍了,以免存在广告之嫌,Google搜索即可知道)中都存在,很容易被轻易穿透。包含微软为ASP提供的一组安全过滤函数里面同样存在这个问题。
URLScan同样存在这个问题,但是URLScan 3.0beta我还没有测试过。所以大家在开发ISAPI Request Filter中要注意这一点。
http://www.ietf.org/rfc/rfc2396.txt
IIS 7.0修补程序:
http://support.microsoft.com/kb/957508/en-us
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
最近几天发现我始终不能在博客堂发布带有较多图片的Blog了,无论是Web发布还是Writer发布,都提示SQL错误:
“
发生服务器错误 0
String or binary data would be truncated.
The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at SubSonic.SqlDataProvider.ExecuteQuery(QueryCommand qry)
at SubSonic.StoredProcedure.Execute()
at Joycode.Framework.Data.DatabaseObjectProvider.InsertEntry(Entry entry) in D:\Projects\Joycode\Joycode.Blog\Joycode.Framework\Data\DatabaseObjectProvider.cs:line 623
at Joycode.Framework.Data.DatabaseObjectProvider.CreateEntry(Entry entry, Int32[] categoryIds) in D:\Projects\Joycode\Joycode.Blog\Joycode.Framework\Data\DatabaseObjectProvider.cs:line 576
at Joycode.Framework.Entries.Create(Entry entry) in D:\Projects\Joycode\Joycode.Blog\Joycode.Framework\Entries.cs:line 259
at Joycode.Framework.XmlRpc.MetaWeblog.newPost(String blogid, String username, String password, Post post, Boolean publish) in D:\Projects\Joycode\Joycode.Blog\Joycode.Framework\XmlRpc\MetaWeblog.cs:line 274
”
比如这三篇:
Reporting Service Tips 101(#5) - 在报表页面上添加交互式排序
Reporting Service Tips 101(#6) - RS中从一个报表jump到另外一个报表
Reporting Service Tips 101(#7) - 使用RS制作树状可折叠报表
在CnBlogs正常发布,但是博客堂全部失败。
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
一般来说,我们把报表分为两类,一类是ad-hoc的报表,用于实时查询,客户可以输入特定的参数,得到他们感兴趣的报表,还有一类是scheduling的报表,用于自动生成,一般包括daliy,monthly,quarterly和yearly的报表,这种定制类的报表,可以在指定的时间,生成到指定的目录,他们生成的内容也会提前定制,参数不可更改。一般在报表的需求定义中,客户都会要求报表能够做到自动生成,这也就是我们所说的第二类报表,有时候,客户还会要求能够在自动生成的同时,实现自动打印。下面我们来谈谈如何实现报表的自动生成以及自动打印。
首先来谈谈解决方案,由于RS提供web service式的调用,因此我们可以写一个remoting service或者windows service或者仅仅是一段程序,然后由job之类的调用,来实现报表的自动。在程序中,我们调用RS,来实现报表的生成。需要生成的报表列表,报表的参数(时间参数),导出文件的格式,我们定义在数据库里,解决方案简单的用图表来表现如下:
下面我们来谈具体的步骤
第一步:创建项目,添加web引用(C#项目),URL为http://localhost/ReportServer/ReportService.asmx
第二步,取参数以及定义其他的参数。
参数表的内容为:
ReportName PeriodType PromptName1 Prompttype1 Format
SupplierD D date datetime PDF
SupplierM M date datetime PDF
SupplierQ Q date datetime PDF
SupplierY Y date datetime PDF
ReportName为报表的名称,PeriodType为报表的类别,分别是日报,月报,季度报和年报,PromptName1和Prompttype1为参数的名字和类别,如果有需要,可以加更多的参数。Format为报表导出的格式。(为方便描述,下述代码中的参数都写死,实际操作中,会从数据库或者从注册表中读取。)
定义参数的代码为:
ParameterValue[] parameters = null;
parameters[1] = new ParameterValue();
parameters[1].Name = “date”;
parameters[1].Value =”01/01/2008”;
定义其他参数:
string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
string encoding;
string mimeType;
Warning[] warnings = null;
string[] streamIDs = null;
DataSourceCredentials[] credentials = null;
ParameterValue[] used = null;
第三步,生成报表并得到报表的二进制流
ReportingService rep = new ReportingService();
rep.Credentials = rep.Credentials = System.Net.CredentialCache.DefaultCredentials;
byte[] ss = null;
得到报表:
ss = rep.Render(“SupplierD” , “PDF”, null, devInfo, parameters, credentials, null, out encoding, out mimeType, out used, out warnings, out streamIDs);
使用的方法是RS提供的
Render ( Report As string , Format As string , HistoryID As string , DeviceInfo As string , Parameters As ArrayOfParameterValue , Credentials As ArrayOfDataSourceCredentials , ShowHideToggle As string ) As base64Binary
第四步:将生成的报表保存到服务器
FileStream repFile = new FileStream(@“D:\Report\ SupplierD”, FileMode.Create);
repFile.Write(ss, 0, ss.Length);
repFile.Close();
第五步:自动打印生成的报表
System.Diagnostics.ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.Arguments = "/p /h " + @“D:\Report\ SupplierD”;
startInfo.FileName = @"C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"; ; //Replace this with the path of the Acrobat Reader executable file, i.e. AcroRd32.exe
startInfo.UseShellExecute = true;
System.Diagnostics.Process process = Process.Start(startInfo);
process.WaitForExit(10000);
if (process.HasExited == false)
{
process.Kill();
}
这里的方法其实是打印已经生成的PDF文件,所以要求该机器必须装有Acrobat Reader。不选用直接打印二进制数据流,是因为这种打印方法无法设置横向打印(Landscape)或者是竖向打印(Portrait),而报表肯定是有横向有竖向的。不选用打印生成html文件的方式,是因为RS不支持导出HTML,只支持MHTML,而MHTML转成HTML太麻烦。
最后,有几点需要注意的是,RS导出的报表必须是已经发布到Report server上的,调用render方法时,第一个参数Report As string必须和reportserver上的路径一致,比如报表的发布路径是Report/SupplierD,那么这个参数的值为”Report/SupplierD”。还有一个要注意的是如果制作报表时,参数设置成下拉框式(如下图),那么传入的值必须是这些值其中之一或者之几(看是否是Multi-value)。
留言请访问如下链接:
Reporting Service Tips 101(#4) - 使用RS实现报表的自动生成以及在程序中调用RS
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
接上一篇(Reporting Service Tips 101 - 关于使用Sum函数会遇到的问题(1)),谈谈使用sum可能会遇到的另外一个问题。
Dateset的数据如下:
Supplier Revenue status
A 5.00 0
A 6.00 1
A 7.00 0
需求是只用sum算出Supplier A在status为0时候的Revenue总和。单看这个需求,我们其实很容易用在报表中添加分组,或者直接在数据的上一层group来解决,但是在做很多复杂报表的时候,如果能够在计算公式里面去解决一些问题,整个报表的开发过程会简单得多。
报表如下:
计算公式为:=FormatNumber(Sum(Fields!Revenue.Value and Fields!status.Value=0),2)
结果如下:
可以看到,正是我们想要的结果。但是这种方法,在遇到很复杂的报表的时候,有时候会有问题,所以我们还可以用另外一种方法。
报表:
计算公式为:=FormatNumber(Sum(iif(Fields!status.Value=0,Fields!Revenue.Value,0)),2)
结果:
和上一种方法的结果一样,但是这种方法的好处是,基本上无论多复杂的报表,都不会有问题。
留言请访问如下链接:
Reporting Service Tips 101(#3) - 关于使用Sum函数会遇到的问题(2)
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
用过Reporting service (后面都用RS代替)的人对sum这个函数都不会陌生,这个函数的使用率极高并且非常好用,下面我们就来谈谈使用这个函数可能会遇到的一个问题。
我们先假设报表使用的dataset传过来的数据如下
Supplier Revenue
A 0.00
B 0.00
报表的需求是要算出每个Supplier的Revenue所占的比率。我们在报表中新建一个table,table中新建一个group,group绑定的值为Fields!SupplierName.Value,group的名字为SupplierGroup,该Dataset的名字为Dssup。报表如下:
可以看到比率的计算公式为:
=FormatPercent(Sum(Fields!Revenue.Value,"SupplierGroup")/Sum(Fields!Revenue.Value,"Dssup"),2)
但事实上,由这个计算公式得到的值却是这样:
这个很好理解,是因为我们的计算公式的分母为0,所以出现了NaN这种值,这个时候,按照正常的逻辑,我们都会选择先判断一下分母,改后的计算公式是这样(为了便于查看,先去掉函数FormatPercent):
iif(Sum(Fields!Revenue.Value,"Dssup") = 0, 0.00%, Sum(Fields!Revenue.Value,"SupplierGroup")/Sum(Fields!Revenue.Value,"Dssup"))
这个是说如果分母为0,那么传回0.00%,反之通过公式计算。从这个公式来看,没有问题,但是不幸的是,结果依然是NaN。
那么怎么办呢,继续尝试下去,改计算公式为
iif(Sum(Fields!Revenue.Value,"SupplierGroup")/Sum(Fields!Revenue.Value,"Dssup")=’NaN’, 0.00%, Sum(Fields!Revenue.Value,"SupplierGroup")/Sum(Fields!Revenue.Value,"Dssup"))
结果证明,改成这样,还是不行。
这个时候,考虑到当Sum(Fields!Revenue.Value,"Dssup") = 0 时,Sum(Fields!Revenue.Value,"SupplierGroup")一定也为0,所以改计算公式为:
Sum(Fields!Revenue.Value,"SupplierGroup")/iif(Sum(Fields!Revenue.Value,"Dssup")=0,1,Sum(Fields!Revenue.Value,"Dssup"))
既如果分母为0,那么强制将分母变为1,最后结果为
这是我们想要的结果。最终计算公式是:
=FormatPercent(Sum(Fields!Revenue.Value,"SupplierGroup")/iif(Sum(Fields!Revenue.Value,"Dssup")=0,1,Sum(Fields!Revenue.Value,"Dssup")),2)
留言请访问如下链接: Reporting Service Tips 101(#2) - 关于使用Sum函数会遇到的问题(1)
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
Reporting Service有三种报表发布方式:
一、是在报表管理器上直接上传报表,创建数据源,这种方式很麻烦,只适用于少量的报表。
二、是在VS.net里的project里面直接发布,这种只适用于开发环境。
三、就是使用RSS脚本进行自动发布。下面我们就来初步了解一下RSS这种发布方式。
默认情况下,安装完Reporting Service,我们可以在Microsoft SQL Server\90\Samples\Reporting Services\Script Samples目录下找到一个名为PublishSampleReports.rss的文件,同时在联机文件中,我们也可以找到该文件。这个RSS文件就是自动发布的脚本,但是内容比较基础简单,下面我们在这个文件基础上进行一些扩展。
1. 这个是一个比较重要的问题,提供的RSS脚本,要求默认windows认证或者允许匿名访问,但是在实际的生产环境中,一般是用的域认证,且出于安全考虑,禁止匿名访问。所以这一块,我们要改变RSS的认证方式。
已有的代码是:
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
改为:
rs.Credentials = new System.Net.NetworkCredential(User_Name,User_Password,User_domin)
然后在命令行里面加上这三个参数即可:
rs -i PublishSampleReports.rss -s http://ReportServerName/reportserver -u UserName -p UserPassword\Userdomin
在指定的服务器上进行发布时,有关权限问题这一块,我们还应当考虑是否拥有报表服务器的访问权限,以及是否对对要访问的报表服务器的根文件夹具有相应的权限。在实际操作中,权限问题是报得最多的error。
2.该脚本必须用Visual Studio VB.NET语言编写,因此也可以用VB.NET进行一些额外的操作,例如判断报表是否已经被发布。
留言请访问:Reporting Service Tips 101(#1) - 使用RSS在指定的服务器上自动进行ReportingService报表发布
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform
先从SQL注入攻击说起吧。
前一段时间的SQL注入攻击可以说让国内以及国外大量网站沦陷,几个攻击变种中幸好是update而不是delete,否则众多网站损失更大,不过从犯罪的角度来说,并不是这些攻击者心慈手软,而是update才能置入网页木马,也才能在置入成功后获得预期的利润。此次大规模的SQL Injection是使用一个叫做Asprox的自动化工具来借助Google搜索引擎寻找目标网站并自动实施SQL注入的,就连趋势科技网站也未能幸免,惨被注入。此次SQL注入攻击风潮从3月份开始,进入6月份后被攻击的网站仍在大量沦陷。
在很多所谓的开发高手来看,SQL注入只是菜鸟才会犯的低级错误,其实不然。一个中大型的网站,在他不断发展的过程中,网站门户的程序都是Patch模式的逐步叠加,随着页面的增加以及版本的螺旋上升,SQL注入的危险百分比也会指数增长,尤其是国内各个网站开发的模式而言。当一个中大型网站的页面达到几万甚至几十万的时候,当这个网站的程序不断叠加积累,诸多历史页面已经处于失控的时候,如何避免SQL Inject攻击将会是一件令人非常头疼的事情,因为你此时是不可能完全重写整个网站或者完全对所有页面做代码安全审核的。
在这众多的历史页面代码中,一个微小的疏漏就导致你的DB完全向攻击者敞开,甚至威胁到服务器磁盘数据。不要侥幸的认为,你的漏洞页面有可能隐藏的很深,现在对于Google而言,什么都不是隐藏的,再加上SQL注入的自动化操作,你的历史页面越多,你的危险就越大。
我以SQL Injection为例就是为了说明其实Web威胁攻击并不是说需要多么高深的技术才可以进行实施,这些攻击往往是你在认为很简单就可以抵御的时候来进行实施的。另外一个极端就是,所谓的社会工程学攻击,各位可以Google一下就会了解。可以说 ,目前的各类攻击已经不再像很早以前那样为了显示自身技术而进行的有意或无意的攻击破坏了,现在大量的Web攻击都是带有利益驱使性的,也更具危害性。
这些Web攻击都是非常危险的,因为不论你的硬件防火墙或者入侵检测系统如何强大,是无法判断这类Web攻击的,因为它们都是合法的HTTP请求。所以根据统计,目前的Web攻击除了操作系统以及各类服务器端应用软件的漏洞外,绝大部分(70%以上)都是此类“合法的”Web攻击。
因此,抵御此类攻击一是需要检测你的应用程序代码,二是可以采用服务器端的针对访问请求以及内容的检测过滤。
针对第一类,目前业界有非常多的安全检测工具,比如HP WebInspect,NStalker-WAS(NStalker-Web Application Security Scanner),IBM Rational AppScan(Watchfire AppScan),Acunetix Web Vulnerability Scanner等等,当然这里我列举的都是商业软件,而没有包含相应的开源软件,在这方面而言,商业软件用来做安全威胁评估的优势更明显,也更合适。
这类模拟攻击检测软件有庞大的规则库以及模拟场景库,可以代替繁杂易错的人工检测。
针对第二类,则可以通过服务器端的过滤和监测机制来最大程度上保证IIS Web服务器的安全,比如微软的IIS Lock。在IIS 7推出后,做此类过滤更加简单和便捷了。国内外也有针对此类的软件产品,比如Port80 ServerDefender。这类产品可以在服务器端对于HTTP Request / POST / Cookie等做过滤和检测,抵御此类Web攻击。
(此图片转自于IBM网站,特注明)
排名前两位的是XSS攻击以及SQL Injection攻击。对于XSS攻击,很多开发者想必会嗤之以鼻的,因为目前而言XSS攻击都很少能破坏掉服务器端的数据,但是XSS最大危害在于钓鱼式攻击,这对于一个成功的网站而言,对其信誉的打击将是致命的,因为展现在用户面前的是合法的网站URL地址,只是XSS攻击部分被编码了。一旦用户遭受此类攻击,对于你网站的信任将会大大降低,现在有什么比得罪你的忠实用户的危害性更大呢?
上面我们提到了很多安全检测工具,其中提到的那四种工具我都有过一定使用(Trial或者Test),其中的AppScan是我印象最为深刻的,也是效果较好的一个。Rational家族随着IBM的不断收购,已经越来越庞大,通过收购Watchfire从而获得了这款企业级安全检测产品,并被Rational产品系列所整合,使之符合Rational的完整涵盖软件生命周期的目的。
Rational AppScan开发版本会有针对于Visual Studio 的AddIn,来在程序开发过程中就能进行代码安全审计和检测;同时也有QA版本;当然我们使用更多的是产品发布后定期的安全审计以及检测了。各版本的比较可以参见:http://www-142.ibm.com/software/dre/hmc/compare.wss?HMC02=C126096V43460Q17
Rational AppScan 7.7全功能测试版本在IBM网站可以免费下载到(http://www14.software.ibm.com/webapp/download/search.jsp?pn=Rational+AppScan),目前CSDN好像也在进行AppScan的市场活动,有兴趣可以去CSDN找一下即可。
下一个post会详细讲述一下如何针对一个真实网站进行安全审计。
---
可能的大概目录
Web攻击和防御(一) - 安全检测工具(1)介绍
Web攻击和防御(二) - 安全检测工具(2)AppScan详解
Web攻击和防御(三) - 安全检测工具(3)AppScan数据分析
Web攻击和防御(四) - IIS安全防护,IIS Filter介绍
Web攻击和防御(五) - IIS安全防护,IIS Extend介绍
Web攻击和防御(六) - IIS安全防护,IIS 5.x 、6、7区别对待
Web攻击和防御(七) - Web Server Guard介绍
Web攻击和防御(八) - Web Server Guard安全防护使用详解
Web攻击和防御(九) - Web Server Guard性能调优使用详解
Web攻击和防御(十) - Web Server Guard服务器监测使用详解
Web攻击和防御(十一) - 完成不可能的事情:使用C#编写IIS Filter(IIS 5.x/6.0)
Web攻击和防御(十二) - IIS 7.0 Filter
Web攻击和防御(十三) - IIS 7.0 安全防护
Web攻击和防御(..... ) - ..........
推荐文章
- 博客堂源代码发布已经发布于Codeplex,邀请您来捉臭虫
- VS 2010 和 .NET 4.0 系列之《ASP.NET 4中的可扩展输出缓存》篇
- 关于技术争论(尤其是ASP.NET Web Forms 和 ASP.NET MVC 之争)
- SharePoint服务器连接配置数据库的连接字符串保存在哪里?
- 为SharePoint 2010创建Application Page
- ASP.NET MVC 2博客系列之二:模型验证
- WPF/Silverlight 控件的几幅继承关系图
- DependencyProperty
- SharePoint 2010中新增的GetItemByIdSelectedFields方法
- SQL IP to BigInt
- MatrixTransform








