Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

302 Object Moved response

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Zester - 06 Dec 2007 23:48 GMT
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!
John Timney (MVP) - 07 Dec 2007 00:15 GMT
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

> Hi,
>
[quoted text clipped - 20 lines]
>
> thank you very much!
Ken Schaefer - 07 Dec 2007 02:33 GMT
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

Signature

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

> Hi,
>
[quoted text clipped - 20 lines]
>
> thank you very much!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.