Skip to content

Commit 89cfcda

Browse files
authored
Fix: replace bitwise & with short-circuit && in handler type checks
Signed-off-by: Joachim Fosse <56757601+joaf123@users.noreply.github.com>
1 parent 744d3e4 commit 89cfcda

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

AuthorizationHttpModule.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private void OnPostAuthorizeRequest(object sender, EventArgs e) {
8989
};
9090

9191
//The request is for a HttpHandler Class:
92-
if (!(context.Handler is Page) & context.Request.CurrentExecutionFilePathExtension == ".ashx") {
92+
if (!(context.Handler is Page) && context.Request.CurrentExecutionFilePathExtension == ".ashx") {
9393
var segments = requestUrl.Split(new[] { ".ashx" }, StringSplitOptions.RemoveEmptyEntries);
9494
if (segments.Length > 0) {
9595
string ashxUrlWithoutMethod = $"{segments[0]}.ashx"; // Remove queryStrings from URL
@@ -108,7 +108,7 @@ private void OnPostAuthorizeRequest(object sender, EventArgs e) {
108108
}
109109

110110
//The request is for a WebService Class:
111-
if (!(context.Handler is Page) & context.Request.CurrentExecutionFilePathExtension == ".asmx") {
111+
if (!(context.Handler is Page) && context.Request.CurrentExecutionFilePathExtension == ".asmx") {
112112
var segments = requestUrl.Split(new[] { ".asmx/" }, StringSplitOptions.RemoveEmptyEntries);
113113
if (segments.Length > 1) {
114114
string methodName = segments[1]; // Extract the part after .asmx/ as the method name
@@ -205,3 +205,4 @@ public static void UseAuthentication(this HttpApplication application) {
205205
}
206206
}
207207

208+

0 commit comments

Comments
 (0)