I have already used the second-level domain name redirection for asp, but I can't use another method: I can't use the Redirection Program for front-end JS and ASP, the program has been debugged but cannot be switched. I don't know why. Please help me identify the cause. Thank you !!!
<%
Dim whkDbq, whkSql, whkRs, whkCount
Set whkConn = Server. CreateObject ("ADODB. Connection ")
WhkDbq = Server. MapPath ("SqlTaoFun. mdb ")
WhkConn. Open "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & whkDbq
WhkSql = "select bh, id from UserInfo where State = '3 '"
Set whkRS = Server. CreateObject ("ADODB. Recordset ")
WhkRs. open whkSql, whkConn, 3
%>
<Script language = "javascript">
Var records = [], whkCoun = 0, whkFlag = 0;
<%
Do while not whkRs. Eof
%>
Records [whkCoun] = new Array ("<% = whkRs (" bh ") %>", "<% = whkRs (" id ") %> ");
Document. write ("whkCoun:" + whkCoun + "records [" + whkCoun + "]: "+ records [whkCoun] [0] + records [whkCoun] [1] +" <br> ");
WhkCoun = whkCoun + 1;
<%
WhkRs. MoveNext
'Whkconn = whkConn + 1
Loop
'Response. End ()
%>
WhkUrl = document. location. href;
Document. write (whkUrl)
WhkUrl = whkUrl. replace ("http ://","");
WhkUrl = whkUrl. substring (0, whkUrl. indexOf ("/"));
Document. write ("<br> whkUrl:" + whkUrl );
If (whkUrl. toLowerCase ()! = "Www.taofun.cn ")
{
Var whkFirstP = whkUrl. indexOf ("."), whkEndP = whkUrl. lastIndexOf ("."), gotoUrl;
If (whkFirstP = whkEndP) & (whkFirstP! =-1) | (whkEndP! =-1 )))
{
WhkFlag = 0;
Window. alert ("taofun.cn ");
// Window. location. href = "http://www.taofun.cn /"
}
Else
{
If (whkUrl = "localhost ")
{
WhkFlag = 0;
Window. alert ("localhost ");
}
Else
{
Var whkUrl2 = whkUrl. substring (0, whkUrl. indexOf ("."));
Document. write ("<br> whkUrl2:" + whkUrl2 );
If (whkUrl2.toLowerCase () = "www ")
{
If (whkUrl. indexOf (".", whkFirstP + 1) = whkUrl. lastIndexOf (".", whkEndP-1 ))
For (I = 0; I <whkCoun; I ++)
{
Document. write ("<br> the read bh:" + records [I] [0]);
If (records [I] [0] = whkUrl. substring (whkFirstP + 1, whkUrl. indexOf (".", whkFirstP + 1 )))
{
WhkFlag = 1;
GotoUrl = "http://www.taofun.cn/show/Shop.asp? Id = "+ records [I] [1];
Window. alert ("find" + records [I] [0] + "second-level domain name. ");
Break;
}
}
Else
{
WhkFlag = 0;
Window. alert ("too many inputs! ");
// Window. location. href = "http://www.taofun.cn /";
}
}
Else
{
WhkFlag = 0;
Window. alert ("Start with www ");
// Window. location. href = "http://www.taofun.cn /";
}
}
}
}
Else
{
WhkFlag = 0;
Window. alert ("go to the homepage! ");
// Window. location. href = whkUrl;
}
Document. write ("<br> final result:" + gotoUrl + whkwhkwhk );
If (whkFlag = 1)
{
Document. write ("<frameset cols = \" * \ "> <frame frameborder = \" 0 \ "scrolling = \" auto \ "src = \" "+ gotoUrl + "\"> <\/frameset> ");
}
</Script>