G
Guest
I have come across a very strange bug while working with an HTTPModule.
The bug appears to manifest itself when in the context_BeginRequest
making a call to context.Request.QueryString["SomeItem"] when no items are
specified.
Example code is
try
{
if (context.Request.QueryString["AnyKey"]!=null) { ... do some code
with it; }
} catch (Exception ex) { ... handle error here which never gets touched
because no error is thrown }
Down Below We have our Actual
context.Context.RewritePath(ActualUrl);
Now Stepping through the code line by Line I see that if we query with
Bleah.aspx?anyvalue=1
it goes through the above code and works As expected
however if i go bleah.aspx without it it goes through the code and then gets
done. But when the browser comes back even though the actual URL rewritten
is the same both times it comes back with a 404 Error.
in the "Requested URL" field it shows the same URL. and in the ActualUrl (in
debug mode) both are exactly the same.
The only difference is if no Parameters were added via the original URL and
a Request Is attempted for them it results in a 404
bleah.aspx?id=101 goes to this.aspx - Works fine - Even though were were
asking for the field AnyKey and not id
bleah.aspx goes to this.aspx - 404
This is occurring on an XP Pro System. I have not even dared to move the
project over to the live server as it is so big and i've spent the last 5
hours pinpointing exactly where and what the problem is
The bug appears to manifest itself when in the context_BeginRequest
making a call to context.Request.QueryString["SomeItem"] when no items are
specified.
Example code is
try
{
if (context.Request.QueryString["AnyKey"]!=null) { ... do some code
with it; }
} catch (Exception ex) { ... handle error here which never gets touched
because no error is thrown }
Down Below We have our Actual
context.Context.RewritePath(ActualUrl);
Now Stepping through the code line by Line I see that if we query with
Bleah.aspx?anyvalue=1
it goes through the above code and works As expected
however if i go bleah.aspx without it it goes through the code and then gets
done. But when the browser comes back even though the actual URL rewritten
is the same both times it comes back with a 404 Error.
in the "Requested URL" field it shows the same URL. and in the ActualUrl (in
debug mode) both are exactly the same.
The only difference is if no Parameters were added via the original URL and
a Request Is attempted for them it results in a 404
bleah.aspx?id=101 goes to this.aspx - Works fine - Even though were were
asking for the field AnyKey and not id
bleah.aspx goes to this.aspx - 404
This is occurring on an XP Pro System. I have not even dared to move the
project over to the live server as it is so big and i've spent the last 5
hours pinpointing exactly where and what the problem is