page redirection

inzo21

Regular
Joined
Nov 5, 2003
Messages
74
Hello all,

I'm trying to do the following with no success: Redirect a page request to a subdirectory of a website. So for instance, when someone enters the URL of http://subdomain.somesite.com I want it to redirect to www.somesite.com/subdomainfolder/index.aspx.

The code I am using is traditional ASP code embedded in the default document of www.somesite.com. Here it is:

<%
If InStr( Ucase(Request.ServerVariables("SERVER_NAME")), Ucase("http://subdomain.somesite.com") ) > 0 Then
Response.Redirect("http://www.somesite.com/subdomainfolder/index.aspx")
End if
%>

This is the second line in my index.aspx page for the main website. The Response.redirect fires when it is isolated but when I type in the subdomain.somesite.com, noting fires.

Does anyone have any ideas or am I using ASP code that won't work in ASP.NET?

thanks in advance.

inzo
 
Just a comment about your instr statement up there, you don't need the UCASE functions, as the instr function defaults to "CompareMethod.Text", which ignores case senstivity anyway.

Common mistake people make I think.
 
Back
Top