+#if NET_4_0
+ if (HttpRequest.ValidateRequestNewMode) {
+ char[] invalidChars = HttpRequest.RequestPathInvalidCharacters;
+ HttpRequest req = context.Request;
+ if (invalidChars != null && req != null) {
+ string path = req.PathNoValidation;
+ int idx = path != null ? path.IndexOfAny (invalidChars) : -1;
+ if (idx != -1)
+ throw HttpException.NewWithCode (
+ String.Format ("A potentially dangerous Request.Path value was detected from the client ({0}).", path [idx]),
+ WebEventCodes.RuntimeErrorValidationFailure
+ );
+ }
+ }
+#endif
+ context.MapRequestHandlerDone = false;
+ StartTimer ("BeginRequest");
+ eventHandler = Events [BeginRequestEvent];
+ if (eventHandler != null) {
+ foreach (bool stop in RunHooks (eventHandler))