Page is a not externally linkable
- Microsoft
-- Microsoft IIS Web Server and ASP.NET
---- 301 rewrite problems in global.asa


Ocean10000 - 6:02 pm on Sep 29, 2009 (gmt 0)


<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart

End Sub

Sub Application_OnEnd
'nothing needed here for this example
End Sub

Sub Session_OnStart
Application.lock
Application("ActiveUsers") = Application("ActiveUsers") + 1
Application.unlock

Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "myNewSite.com"
'Destroys the Session. So that future calls will retrigger this code.
Session.Abandon
'Sends buffered output immediately.
Response.Flush
'Stops processing the .asp file and returns the current result.
Response.End
End Sub

Sub Session_OnEnd
Application.lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.unlock
End Sub

</SCRIPT>

References
Response Object [msdn.microsoft.com]

Session Object [msdn.microsoft.com]


Thread source:: http://www.webmasterworld.com/microsoft_asp_net/3997671.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com