473,663 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

redirect using addheader not working

1 New Member
Hi I'm trying to use this bit of code that I found in a few places to redirect the page to a 404.html page...

Response.Status ="404 Not Found"
Response.AddHea der "Location","htt p://sitename/404.html"

It doesn't seem to work but just returns an error. As far as the header is concerned it gives us exactly what we want but just doesn't do the redirect...

Using the same bit of code but with a 301 Permanently Moved does do the redirect but doesn't give us the proper header...


Response.Status ="301 Permanently Moved"
Response.AddHea der "Location","htt p://sitename/404.html"


If I use the response.redire ct method anywhere in the page the Status becomes a 302 automatically, hence the reason we are trying to use this code in the top example...

Can anyone help with this?
Mar 22 '11 #1
0 1544

Sign in to post your reply or Sign up for a free account.

Similar topics

1
9611
by: Ravindra | last post by:
Hi, Im trying to use Response.Redirect in Session_End event in Global.asax page, which is not working. Why this is not working? And if this not works here, how do I hanlde this? Any possible and best solutions will be helpful. N.B.: Here my intention is to redirect to, say Login page, when the user session ends. Thanks in advance, K.V.Ravindra Kumar
4
1773
by: Greg Scharlemann | last post by:
I thought I had a workable approach to specifing which pages required a redirect in a config file, but it appears the way I'm attempting to do it is not going to work. The idea is that I can specify in the config file all of the pages that require a user to login otherwise the page will redirect if the user is not logged in. config.php looks like this: ----------------------
0
1787
by: Sameer Deshpande | last post by:
Hi, I am using python SOAPpy module to call a web service. Call to web service gets executed successfully. I am facing a problem if the call to WS results into redirect. I get "HTTPError: <HTTPError 302 Moved Temporarily>" If I enable the debug info, I do get the new redirected url. How do I divert my WS request to new url?
14
3952
by: gaurav tyagi | last post by:
in my appplication if i try to go to next page using response.redirect, it does not work and control remains on same page but if i use server.transfer control goes to nex page?? can any one explain me why ?????
4
2252
by: davidfahy | last post by:
Hi all How can I transfer user to another server using POST. The problem is that Server.Transfer (preserves form data) works just in current server. Response.Redirect - uses GET method. However I have to open a remote server page using POST method. Using HttpWebRequest class is not good solution, as I can post to and read data from remote server, but user browser itselft is still connected to my
1
1267
by: Samuel Shulman | last post by:
Hi I am looking for a way to send a POST request using the Reponse.Redirect or any thing similar Thank you, Samuel
5
2016
by: Samuel Shulman | last post by:
Hi I would like to redirect say from http://mysite.co.uk to http://www.mysite.co.uk but because my home page is html I have to use JS Thank you, Samuel
2
1385
by: mitDAS | last post by:
I have problems with redirecting in Mono. Nor Server.Transfer, nor Response.Redirect have working. I have not ANY problems under Windows XP. I am using C#. Please help!
2
1659
by: kathirgee | last post by:
I Used the following code for redirect header('Location: filename.php'); but i get error msg like this Warning: Cannot modify header information - headers already sent by (output started at D:\wamp\www\kathir\nextpage.php:19) in .............
0
8436
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8858
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8771
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...
0
8634
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
5657
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
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.