views:

22

answers:

1

hello. i think i got some problems with setting a cookie data. for this code:

        Set cmdDB = Server.CreateObject("ADODB.Command")
        With cmdDB
            .ActiveConnection = ADOConM
            .CommandText = "usp_jaljava_member_select"
            .CommandType = adCmdStoredProc
            .Parameters.Append .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 0)
            .Parameters.Append .CreateParameter("@TLoginName", adVarChar, adParamInput, 15,lcase(TLoginName))
            .Parameters.Append .CreateParameter("@TPassword", adVarChar, adParamInput, 20,TPassword)
            .Parameters.Append .CreateParameter("@retval", adVarChar, adParamOutput, 50)
'           .Parameters.Append .CreateParameter("@TPinCode", adVarChar, adParamInput, 15,TPinCode)
            .Execute,,adExecuteNoRecords

            RetVal = .Parameters("@retval")
            Ret = Trim(.Parameters("RETURN_VALUE"))

            'Set .ActiveConnection = Nothing
        End With
        Set cmdDB = Nothing

        UTid = RetVal

        if Ret = 100 then
            deleteInvalidLogin(TLoginName)
            SetDomainCookie "UTid",UTid
            SetDomainCookie "Uid", TLoginName

            if redirect_domain <> "" then
                Response.Write  "<form name=frm action=" & urlserver & " method=post><input type=hidden name=loginname value='" & TLoginName & "'><input type=hidden name=id value=""" & Request.Cookies("UTID") & """></form><script>frm.submit();</script>"
                Response.End
            else%>
                <%
                    Response.Redirect ("kologin.asp?id=OK")

                    Response.End
            end if

RETURN_VALUE is returns as 100. But I don't know.. UTID! What is UTID have to be? If I set UTID same as UID will it work? thanks..

A: 

I'm not sure I understand the question. I think your problem is that you expect Request.Cookies("UTID") to be available immediately after setting it (I assume this is done in the SetDomainCookie function, which you forgot to include). I haven't worked in classic ASP for a long time but if I remember right the scope of the ASP script will not have access to that cookie value until you make another pass (e.g. reload the page). So I would suggest retrieving the value from the server-side script at the page represented by urlserver, or just populate the form field using the local UTid variable instead of the Request.Cookies() value:

Response.Write "...<input type=hidden name=id value=""" & UTid & """>"
Aaron Bertrand