302 Object Moved response

Z

Zester

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!
 
J

John Timney \(MVP\)

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
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top