Forum Moderators: open

Message Too Old, No Replies

server,transfer 302 error

         

cowcool

4:35 pm on Apr 5, 2003 (gmt 0)

10+ Year Member



Hi Folks,

I am trying to make my dynamic site to be search engine friendly and have successfully implemented 404.asp and server.transfer in iis 5.0

However everytime I redirect non existing document using 404.asp ans server.transfer , 404.asp always generate 302 header which is not desireable.

I have added Response.Status = "200 OK" command to my 404.asp but it's not working, I still get 302 error

Here is the code i use in 404.asp
==================================

<%
Response.Status = "200 OK"
strQ = Request.ServerVariables("QUERY_STRING")
if instr(strQ,"msg") then
posawal = InStrRev(strq, "msg")
strq = Mid(strq, posawal + 3, 20)
strq = Replace(strq, ".htm", "")

session("teemid")=strq
Server.Transfer("forum/teem.asp")
end if
%>

How do I tell IIS to return "200 OK" header?. Where did I make mistake?. I do not want "302" header because I am afraid it will make my site nit crawable.

Thx,
Andy

Dreamquick

10:50 am on Apr 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



IIS is issuing the 302 from the page you requested to the 404.asp right?

The solution requires that you have access to the IIS Management Console, or possibly an extremely detailed web-based control interface...

1) Select your website
2) Select the "home directory" tab
3) Click the "configuration" button
4) Select the ".asp" entry
5) Click the edit button
6) Check the "Check that file exists" checkbox

"Ok" your way out of the console & dialogs. You should now find that requesting the missing resource now directly trips your 404.asp rather than forcing IIS through a 302 redirect first.

BTW this 302 stuff can't be the kiss of death because lots of people (including myself) run 404's in the default IIS-302 > custom 404 configuration.

- Tony