我只想处理操作,但看起来像 Application_BeginRequest 方法也处理 CSS、图像等...
如何避免?
因为听起来我不能只为操作覆盖内容:
HttpContext.Current.RewritePath("~/Maintenance.html");
请您参考如下方法:
如果你想限制只对网络表单请求做某事,我使用了类似下面的东西:
protected void Application_BeginRequest(object sender, System.EventArgs e)
{
if(HttpContext.Current.Request.CurrentExecutionFilePathExtension == ".aspx"){
//stuff to do
}
}
