global.asax issue

T

Tem

I've been stuck on this error for days.
I use global.asax to do url rewrite. which works fine on one server but not
the other. they are both windows server 2003 R2 IIS6.

if I do
http://test.com/photo/123
which would rewrite to http://test.com/photo/default.aspx?photo=123

on the server that doesn't work, it gives me a 404 error

but if I go and create a 123 folder under photo and a blank default.aspx, it
would work and display the correct page.
so this means global.asax is not being triggered

There must be a setting somewhere
Please help

Tem
 
L

Leon Mayne

Tem said:
I've been stuck on this error for days.
I use global.asax to do url rewrite. which works fine on one server but
not the other. they are both windows server 2003 R2 IIS6.

if I do
http://test.com/photo/123
which would rewrite to http://test.com/photo/default.aspx?photo=123

on the server that doesn't work, it gives me a 404 error

but if I go and create a 123 folder under photo and a blank default.aspx,
it would work and display the correct page.
so this means global.asax is not being triggered

There must be a setting somewhere
Please help

Make sure the folder the global.asax is sitting in is configured as an
application in IIS, and that there is a web.config in the folder with it.
 
G

grava

Leon Mayne said:
Make sure the folder the global.asax is sitting in is configured as an
application in IIS, and that there is a web.config in the folder with it.

Check IIS Configuration settings and check that IIS isn't checking for
existence of the page!!!!

I don't know how to do for a page without extension like yours, but if you
map something like "123.do" and check the extension ".do" configuration in
IIS -> Properties -> Applcation Configuration -> mappings ... you'll find a
checkbox "Check that file exists" in your ".do" mapping configuration.

HTH
 
A

Alan Silver

Tem said:
I've been stuck on this error for days.
I use global.asax to do url rewrite. which works fine on one server but
not the other. they are both windows server 2003 R2 IIS6.

OK, not sure why it works on one server, but I can tell you it's not
working on the other ;-)

which doesn't have an .aspx ending, so the request will not be passed to
the ASP.NET engine...

....assuming it gets passed to ASP.NET, which it shouldn't. I am at a
loss as to how this works on any machine, unless you've configured IIS
to pass EVERY request to ASP.NET
on the server that doesn't work, it gives me a 404 error

Correct, because IIS itself can't find such a folder.
but if I go and create a 123 folder under photo and a blank
default.aspx,

so the request now gets passed to ASP.NET
it would work and display the correct page.

as ASP.NET processes the request, so the code in your global.asax is
being given chance to run.
so this means global.asax is not being triggered

No, because the request was not being passed to ASP.NET
There must be a setting somewhere

Not quite, it's more a case of rethinking how you are going to do URL
rewriting, unless you want to pass every single request through ASP.NET,
which is a very good idea ;-)
Please help

How about doing the rewriting like this...

http://test.com/photo123.aspx

which would rewrite to...

http://test.com/photo/default.aspx?photo=123

That would be fairly easy, and should work without problem.

I know the idea of URL rewriting without any file endings would be nice,
but it's not practical in most cases. This is one instance where
mod_rewrite has some advantages over URL rewriting as it works at the
server level, not at the script-processing level.

HTH
 
F

Fabrizio Cipriani

Tem said:
I've been stuck on this error for days.
I use global.asax to do url rewrite. which works fine on one server but not
the other. they are both windows server 2003 R2 IIS6.

if I do
http://test.com/photo/123
which would rewrite to http://test.com/photo/default.aspx?photo=123

on the server that doesn't work, it gives me a 404 error

but if I go and create a 123 folder under photo and a blank default.aspx, it
would work and display the correct page.
so this means global.asax is not being triggered

There must be a setting somewhere
Please help

Tem

If your problem is to redirect extensionless urls, check
http://msmvps.com/blogs/omar/archiv...g-isapi-module-or-iis-6-wildcard-mapping.aspx
 
T

Tem

It's works on our development server which is a fresh install of windows.
all default settings.
It does not work on the other server, our product server. but I did compare
the settings, didn't see anything different.
so strange

you are right about the asp.net engine not being called. that's why I worked
when I created an empty default.aspx file.

I thought global.asax is part of the application not just asp.net. I've
noticed that global.asax (using debug breakpoints with visual studio) gets
called even for files like javascript and jpg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top