Avatar of ullfindsmit
ullfindsmit
Flag for United States of America asked on

IIS 7.5 returns 404 and does not trigger Application_BeginRequest

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?
Microsoft IIS Web ServerASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
Steven Carnahan

8/22/2022 - Mon
Neil Russell

They are two different URLs is it two different web applications?
ullfindsmit

ASKER
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 Saini

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.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ullfindsmit

ASKER
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 Carnahan

%20 = space
%2b = +
ullfindsmit

ASKER
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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Steven Carnahan

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
ullfindsmit

ASKER
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.
ASKER CERTIFIED SOLUTION
Steven Carnahan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ullfindsmit

ASKER
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
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Steven Carnahan

Glad to be of assistance.