473,473 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

302 Object Moved response

Hi,

Sorry for this multi-posts; I don't know where the setting if it exists so
I'm posting this to multiple groups.

I was told that Response.Redirect would generate the http 302 Object Moved
status in the response; but I couldn't get it to work. I created a project
from scratch with just 2 pages and it keeps giving me 302 Object Found.

Upon button click on one page (POST), I redirect to another; here is the
simple code:
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect( "Destination.aspx" ); // I have tried to use the other
overloading method with the boolean.
}

I know that if I add this line, it will give me what I want.
Response.Status = "302 Object Moved";

Now, is there a way to make sure *all* POST's redirect in my app returns
"302 Object Moved" instead of the default "302 Object Found"?

thank you very much!

Dec 6 '07 #1
2 3583
You would probably need to create an ihttpmodule that intercepts the
requests, checks for a post event and terminates the request after
generating a 302 using reponse.end in the module

You could check if the request.ServerVariables("REQUEST_METHOD") = "POST" to
determine if its a POST request rather than a GET request. Its probably the
most reliable method I can think of..

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Zester" <ze**@nottospam.comwrote in message
news:uN****************@TK2MSFTNGP06.phx.gbl...
Hi,

Sorry for this multi-posts; I don't know where the setting if it exists so
I'm posting this to multiple groups.

I was told that Response.Redirect would generate the http 302 Object Moved
status in the response; but I couldn't get it to work. I created a project
from scratch with just 2 pages and it keeps giving me 302 Object Found.

Upon button click on one page (POST), I redirect to another; here is the
simple code:
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect( "Destination.aspx" ); // I have tried to use the
other overloading method with the boolean.
}

I know that if I add this line, it will give me what I want.
Response.Status = "302 Object Moved";

Now, is there a way to make sure *all* POST's redirect in my app returns
"302 Object Moved" instead of the default "302 Object Found"?

thank you very much!

Dec 7 '07 #2
Hi,

Why does it matter what the textual reason for the status code is? The
user-agent should really rely on the HTTP status code...

According to the HTTP v1.1 specification 302 is "Found"
http://tools.ietf.org/html/rfc2616#section-10

In HTTP v1.0 was 302 "Temporarily Moved".

Cheers
Ken

--
My IIS Blog: www.adOpenStatic.com/cs/blogs/ken

"Zester" <ze**@nottospam.comwrote in message
news:uN****************@TK2MSFTNGP06.phx.gbl...
Hi,

Sorry for this multi-posts; I don't know where the setting if it exists so
I'm posting this to multiple groups.

I was told that Response.Redirect would generate the http 302 Object Moved
status in the response; but I couldn't get it to work. I created a project
from scratch with just 2 pages and it keeps giving me 302 Object Found.

Upon button click on one page (POST), I redirect to another; here is the
simple code:
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect( "Destination.aspx" ); // I have tried to use the
other overloading method with the boolean.
}

I know that if I add this line, it will give me what I want.
Response.Status = "302 Object Moved";

Now, is there a way to make sure *all* POST's redirect in my app returns
"302 Object Moved" instead of the default "302 Object Found"?

thank you very much!
Dec 7 '07 #3

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

Similar topics

1
by: Daniel Bruno | last post by:
When I use redirection on ASP.NET I get the the message: "Object moved here". Then I have to click on the link to go to the destination page. Is there a way to prevent this from happening, so...
3
by: buran | last post by:
How do I download file from the web when the site uses forms authentication? Without the authentication, webclient object works. Thanks, Buran
1
by: Imran Shabbir | last post by:
Hi all I have developed a web application in ASP.net which is in production and working fine but some time while redirecting from one page to another i get this message on a blank page "Object...
8
by: Brad | last post by:
In one of my asp.net apps a response.redirect is sometimes resulting in the blank page with "Object moved to here." I've tried repsonse.clear and response.buffer (true & false) but still get...
1
by: JohnZing | last post by:
i tried to install asp.net forums all went ok, but after login i always get "Object moved to here." in firefox or "The page cannot be displayed" in IE when i hit refresh, the page loads fine. ...
2
by: ACaunter | last post by:
Hi all, I have the following code in the html part of my asp.net page to display an activeX control object which is like a picture viewer: ---------------------------- Response.Write("<object...
1
by: Ganesh Ramamurthy | last post by:
Hi Experts, I am getting the following error when I do a Response.Redirect from an aspx page to another aspx page. I am using the following code in my global.asax Application_Error event to...
7
by: Rob | last post by:
Hi, I'm getting an error on my login page when using Javascript session object. It works on the development server so I'm wondering if there is a setting in IIS to allow using sessions on the...
2
by: Zester | last post by:
Hi, Sorry for this multi-posts; I don't know where the setting if it exists so I'm posting this to multiple groups. I was told that Response.Redirect would generate the http 302 Object Moved...
0
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,...
0
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...
1
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...
0
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...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
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.