views:

156

answers:

1

I'm upgrading some classic asp pages to .net, but not all of them. Rather than go and modify all the links in this backwards system, which pulls some of its links from a cms data store. I would like to take advantage of http and just remove the code our of that file, and perform a programatic 301 so that all the other pages can just be upgraded piecemeal.

+4  A: 
Response.Buffer = true
Response.Status = "301 Redirect"
Response.AddHeader "Location", "redirection-url-goes-here"
Response.End
Mehrdad Afshari
do you have to do any flushing, or do this in a particular order to other statements?
DevelopingChris
Yes, It's important that you haven't had sent any response to the client before these statements since the first thing in an HTTP response is the header which cannot be modified after it's sent... No you don't have to do any flushing; it's probably your last statement on the page...
Mehrdad Afshari
Response.buffer = true, is also probably a good idea so that it doesn't send line 1 without line 2?
DevelopingChris
I guess the whole HTTP header will be sent just before the first part of content is going to be sent to the client. Nothing special is sent with line 1 in isolation
Mehrdad Afshari
I added the 2 lines that I think solidify making this bulletproof to the other people maintaining this.
DevelopingChris