ASP链接参数未通过

时间:2011-03-04 16:12:20

标签: asp-classic

有时带参数的链接会显示参数,有时则不会。如果我打开IE并在其他选项卡中执行操作并尝试单击其中包含参数的链接,它将进入主屏幕。如果我单击没有打开IE的链接,它将转到带有参数的站点。请帮忙!

示例链接:http://ServerName/time_and_attendance/?timesheet_id=7489

以下代码:

<!--#INCLUDE virtual="/time_and_attendance/i_time_attendance_header.asp" -->
<%
'---------------------------------------------------------------------------------------------------------------------
'JFV 6-10-2010:  Will need these lines uncommented and inserted above the '<!--#INCLUDE' line
'   to be used in the alternate e-mail configuration
'<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Type Library" -->
'<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
'---------------------------------------------------------------------------------------------------------------------
 %>
<%
'If there is not a timesheet id send user back to their employee page
If Request("timesheet_id")<>"" Then
    my_employees_timesheet_id=Request("timesheet_id")
    RedirectUrl="my_employees_timesheet.asp?timesheet_id="&Request("timesheet_id")
    'Response.Write my_employees_timesheet_id
Else
    Response.Redirect("default.asp")
End If
%>

1 个答案:

答案 0 :(得分:4)

在使用之前,您应该使用Request.Querystring而不是简单的RequestTrim

此外,dim变量并首先将参数检索到变量中。

dim ts_id 

ts_id = trim(request.querystring("timesheet_id"))

If ts_id <>"" Then

    my_employees_timesheet_id=ts_id 

    RedirectUrl="my_employees_timesheet.asp?timesheet_id="&ts_id 

    'Response.Write my_employees_timesheet_id

Else

    Response.Redirect("default.asp")

End If