1. 程式人生 > >禁止新增web引用

禁止新增web引用

 public class AsmxHelpModule : System.Web.IHttpModule
    {
       
        private AsmxHelpModule()
        {
        }
       
        private void Application_BeginRequest(object sender, System.EventArgs e)
        {
            string requestPath = HttpContext.Current.Request.RawUrl;
            requestPath = requestPath.Trim();
            requestPath = requestPath.ToLower();
            if (((requestPath.IndexOf("?wsdl") > 0)
                        || (requestPath.IndexOf("?disco") > 0)))
            {
                throw new HttpException(404, "");
            }
        }
       
        public virtual void Init(HttpApplication app)
        {
            app.BeginRequest += new System.EventHandler(this.Application_BeginRequest);
        }
       
        public virtual void Dispose()
        {
        }
    }