asp代码,在线求改

来源:百度知道 编辑:UC知道 时间:2024/05/30 06:01:50
首页,index.asp,若用户已登陆,则在u首页head位置显示welcom.asp.反之则显示login.asp.本人自写代码如下,请高手修改.
<%
if session("userid")<>"" then
response.Write<!--#INCLUDE FILE="welcom.asp"-->
else
response.write<!--#INCLUDE FILE="login.asp"-->
end if
%>
谢谢!

语法错误.代码改成这下面这个,具体问题我已给你解决:

<%if session("userid")<>"" then %>
<!--#INCLUDE FILE="welcom.asp"-->
<%else %>
<!--#INCLUDE FILE="login.asp"-->
<%end if%>

下次写程序的时候一定要保证要用到在文件都存在.

<%
dim rURL
if session("userid")<>"" then
rURL="welcom.asp"
else
rURL="login.asp"
end if
response.write"<!-#include file="&rURL&"-->"
%>

如果你只是想根据这个去跳转页面的话,建议使用response.redirect
<%
dim rURL
if session("userid")<>"" then
rURL="welcom.asp"
else
rURL="login.asp"
end if
response.redirect rURL
%>