2011-03-04 2 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

당신은 그것을 사용하기 전에 대신 단순히 RequestRequest.QuerystringTrim 값을 사용한다.

또한 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

관련 문제