473,722 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTTP 404 Redirect does not work

For some reasons my HTTP Redirect for 404 errors does not work for
certain files like .gif .jpg
on IIS Version: 5.1, but it works perfectly with the VisualStudio200 5
internal webserver

****Web.Config* ***
.......
<customErrors mode="On" defaultRedirect ="http://www.cnn.com">
<error statusCode="403 " redirect="NoAcc ess.htm" />
<error statusCode="404 " redirect="FileN otFound.aspx" />
</customErrors>
.........
*************** ****

IIS 5.1
http://localhost/mywebsite/notExisting.gif ( does not work)
http://localhost/mywebsite/notExisting.aspx ( works!! , it also work
with *.html etc)

VisualStudio200 5 Internal Server
http://localhost:1768/anonymousspeech/notExisting.gif (Works!!)

I guess I have to do some settings on IIS5.1. What do I have to do in
order to get proper redirects also for image file name like .jpg .gif
etc.

Thanks for helping

Aug 22 '06 #1
3 3976
mike,

i believe, you need to map all the extensions to aspnet_isapi filter.

check out this
http://aspadvice.com/blogs/bmiller/a...0/22/2452.aspx for more
details on the same.

Regards,
Augustin
http://augustinprasanna.blogspot.com

"ww*****@gmx.ch " wrote:
For some reasons my HTTP Redirect for 404 errors does not work for
certain files like .gif .jpg
on IIS Version: 5.1, but it works perfectly with the VisualStudio200 5
internal webserver

****Web.Config* ***
.......
<customErrors mode="On" defaultRedirect ="http://www.cnn.com">
<error statusCode="403 " redirect="NoAcc ess.htm" />
<error statusCode="404 " redirect="FileN otFound.aspx" />
</customErrors>
.........
*************** ****

IIS 5.1
http://localhost/mywebsite/notExisting.gif ( does not work)
http://localhost/mywebsite/notExisting.aspx ( works!! , it also work
with *.html etc)

VisualStudio200 5 Internal Server
http://localhost:1768/anonymousspeech/notExisting.gif (Works!!)

I guess I have to do some settings on IIS5.1. What do I have to do in
order to get proper redirects also for image file name like .jpg .gif
etc.

Thanks for helping

Aug 22 '06 #2
i believe, you need to map all the extensions to aspnet_isapi filter.
>
check out this
http://aspadvice.com/blogs/bmiller/a...0/22/2452.aspx for more
details on the same.
Right - but you may not want to do that as it's only going to slow down
the processing. You can change the default error handling properties in
IIS, although this may not give you exactly what you want.

Go to the properties for the site, find the 'Custom Errors' tab and you
can set a default error page there. Although this will only work (I
believe) if the user has the browser configured to show the error page
when a 404 is returned rather than showing the browsers specific 404
message. I'm not sure if you can configure IIS to redirect to a page
when you get a 404 error, hopefully somebody else can answer that,

Kevin

Augustin Prasanna wrote:
mike,

i believe, you need to map all the extensions to aspnet_isapi filter.

check out this
http://aspadvice.com/blogs/bmiller/a...0/22/2452.aspx for more
details on the same.

Regards,
Augustin
http://augustinprasanna.blogspot.com

"ww*****@gmx.ch " wrote:
>For some reasons my HTTP Redirect for 404 errors does not work for
certain files like .gif .jpg
on IIS Version: 5.1, but it works perfectly with the VisualStudio200 5
internal webserver

****Web.Config ****
.......
<customErrors mode="On" defaultRedirect ="http://www.cnn.com">
<error statusCode="403 " redirect="NoAcc ess.htm" />
<error statusCode="404 " redirect="FileN otFound.aspx" />
</customErrors>
.........
************** *****

IIS 5.1
http://localhost/mywebsite/notExisting.gif ( does not work)
http://localhost/mywebsite/notExisting.aspx ( works!! , it also work
with *.html etc)

VisualStudio20 05 Internal Server
http://localhost:1768/anonymousspeech/notExisting.gif (Works!!)

I guess I have to do some settings on IIS5.1. What do I have to do in
order to get proper redirects also for image file name like .jpg .gif
etc.

Thanks for helping

Aug 22 '06 #3
Thanks Kevin,

The 404 redirect helped. Any file not found is redirected to an ASPX
page.

On the ASPX page I get the entire querystring (context.reques t.rawurl).
Then I check if the filename.

This way, I dont need to use any handlers and execution speed does not
decrease for each request.

Luckely my provider set up the 404 redirect on IIS, which you need
since ASP.NET only processes aspx pages but not .gif files.

Thanks

Mike :)

Kevin Jones schrieb:
i believe, you need to map all the extensions to aspnet_isapi filter.
>
check out this
http://aspadvice.com/blogs/bmiller/a...0/22/2452.aspx for more
details on the same.

Right - but you may not want to do that as it's only going to slow down
the processing. You can change the default error handling properties in
IIS, although this may not give you exactly what you want.

Go to the properties for the site, find the 'Custom Errors' tab and you
can set a default error page there. Although this will only work (I
believe) if the user has the browser configured to show the error page
when a 404 is returned rather than showing the browsers specific 404
message. I'm not sure if you can configure IIS to redirect to a page
when you get a 404 error, hopefully somebody else can answer that,

Kevin

Augustin Prasanna wrote:
mike,

i believe, you need to map all the extensions to aspnet_isapi filter.

check out this
http://aspadvice.com/blogs/bmiller/a...0/22/2452.aspx for more
details on the same.

Regards,
Augustin
http://augustinprasanna.blogspot.com

"ww*****@gmx.ch " wrote:
For some reasons my HTTP Redirect for 404 errors does not work for
certain files like .gif .jpg
on IIS Version: 5.1, but it works perfectly with the VisualStudio200 5
internal webserver

****Web.Config* ***
.......
<customErrors mode="On" defaultRedirect ="http://www.cnn.com">
<error statusCode="403 " redirect="NoAcc ess.htm" />
<error statusCode="404 " redirect="FileN otFound.aspx" />
</customErrors>
.........
*************** ****

IIS 5.1
http://localhost/mywebsite/notExisting.gif ( does not work)
http://localhost/mywebsite/notExisting.aspx ( works!! , it also work
with *.html etc)

VisualStudio200 5 Internal Server
http://localhost:1768/anonymousspeech/notExisting.gif (Works!!)

I guess I have to do some settings on IIS5.1. What do I have to do in
order to get proper redirects also for image file name like .jpg .gif
etc.

Thanks for helping

Aug 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5919
by: Don Miller | last post by:
I used a Response.Redirect "page.asp" as the last command in ASP code that processes a submitted form from an Adobe PDF form (using HTML format). For some reason, if there is any linked file (image, stylesheet, javascript) in the target "page.asp" IE hangs until you press Escape. With Refresh, the page loads completely. I checked the web log and the entry for "page.asp" is 200 (OK) but all the files I mentioned above all show 400. The...
2
1898
by: Jason | last post by:
Hello, I have a class, transCore, that does certain work, and by default, prints its progress to the stand output. Later, I will to write a GUI class that encapsulate the transCore class. I would like to redirect/intercept the output of transCore class to this GUI class. I wrote a sample program that demonstrate how I did it, but I am not sure if it's any good. Can anyone critic my code? If there's any non-standard conforming code or...
3
9076
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The problem i faced while using Response.Redirect is that the page that is directed to, does not looks as desired..the textboxes are not visible anymore and so as
5
2152
by: john | last post by:
Hello, One our thrid page for some reason the response.redirect isn't working on the live server. It works fine on the development machine but when we move the code to the live server it doesn't work. The first page is a login page and the response.redirect does work there but not on the third page. Any ideas? Thanks in advance. John
3
7967
by: Jed | last post by:
I have written an HttpHandler which I invoke through an ashx page. The HttpHandler does various things to process the request, then it is supposed to redirect to a confirmation page. Everything up to the redirect works fine, but I can't get the redirect to work. If I do a ... context.Response.Write("Hello World"); .... the HttpHandler works great and the browser loads the text fine, but if I change it to ...
8
24271
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has been sent like If response.IsSentHttpHeader then ....
3
4448
by: Robert Sorger | last post by:
I have a problem with thread execution after calling response.redirect() in a web form. Basically, I want the thread to continue to work (e.g. do some long database work) but want to redirect immediately to another page, so that the user does not have to wait. I tried the wollowing exemple with two webforms webform1.aspx and webform2.aspx : WebForm1.aspx just has one button which, when clicked, executes the following method
7
13449
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am trying to set this up using asp code and IIS configuration. But it seems not working. Here it is the way I am doing. In IIS I set up a virtual directory with secure communication, I checked require secure channel, require 128-bit encryption. In custom error, instead of using default message HTTP 403.4 - Forbidden: SSL required Internet Information Services in iishelp 403.4htm, I am trying to do redirect automatically. so I...
9
2901
by: Nick | last post by:
Hi there, I would like to perform something like the following from my vb.net web service, being invoked via HTTP Post Call HttpContext.Current.Response.Redirect("myprotocol://myurl") Unfortunately I do not seem to be able to redirect to a custom protocol url, any ideas why? Basically I'm trying to implement this functionality so no coding need take place to get the redirection from the consuming web
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.