2011-03-04 61 views
1

有时,带参数的链接会调出参数,有时不会。如果我打开IE浏览器,并在其他选项卡中执行操作,并尝试点击其中的参数链接,它会进入主屏幕。如果我点击没有打开IE的链接,它会通过参数进入站点。请帮忙!不带参数的ASP链接

示例链接: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 
%> 

回答

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 
+0

工作就像一个魅力!我感谢帮助! – JFV 2011-03-04 20:38:01