IIS 7.5 returns 404 and does not trigger Application_BeginRequest

ullfindsmit
ullfindsmit used Ask the Experts™
on
For some weird reason IIS 7.5 will not fire application_beginrequest for
http://dealer24x7.com/1990-1994/Used/1/By-Pass+Motors/Inventory/
But will fire for http://dealer24x7.com/1990-1994/Used/1/By-Pass Motors/Inventory/

Any ideas why?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Neil RussellTechnical Development Lead

Commented:
They are two different URLs is it two different web applications?

Author

Commented:
No same application
Same Server

One is URL Encoded (right way) and does not work
Other is NOT URL Encoded (manually changed it to test) and works
Vikram Singh SainiSoftware Engineer cum AD Developer

Commented:
Hi,

Based on the url you showed us from your question, I am guessing you are using UrlEncode method.

And providing you more detail on that I'm picking paragraph from HttpUtility.UrlEncode Method (String):

You can encode a URL using with the UrlEncode method or the UrlPathEncode method. However, the methods return different results. The UrlEncode method converts each space character to a plus character (+). The UrlPathEncode method converts each space character into the string "%20", which represents a space in hexadecimal notation. Use the UrlPathEncode method when you encode the path portion of a URL in order to guarantee a consistent decoded URL, regardless of which platform or browser performs the decoding.

So I would recommend you to use UrlPathEncode method instead of UrlEncode method.
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Author

Commented:
vs00saini
Its not about how to encode the path, but rather how do I fix IIS to trigger the Application_BeginRequest function so the page shows up

Thanks.
Steven CarnahanAssistant Vice President\Network Manager

Commented:
%20 = space
%2b = +

Author

Commented:
GUYS
SERIOUSLY
YOU NEED TO READ THE POST

I AM NOT ASKING ON HOW TO REWRITE THE URL

I am trying to figure out why the Application_BeginRequest is not being fired and why IIS would not forward the request to the .Net framework

Thanks
Steven CarnahanAssistant Vice President\Network Manager

Commented:
It is not forwarding because it is interpreting the "+" sign NOT as a space character because of the difference between the code.  

http://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-and-when-to-20

Author

Commented:
Thank you for your prompt response.

What do I need to change (Except for the URL, because it comes from various sources) on IIS to make it work?

Please advise
Smit.

Author

Commented:
Excellent
Like hot knife through butter... worked flawlessly

All I had to do was add

<system.webServer>
    <security>
            <requestFiltering allowDoubleEscaping="true" />
    </security>
</system.webServer>

Thank you
Steven CarnahanAssistant Vice President\Network Manager

Commented:
Glad to be of assistance.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial