|
-
Jan 10th, 2001, 05:28 PM
#1
Thread Starter
Member
I have a web page that connects to a database (SQL server) and loops through the data and generates a list of links to go to different areas of the site.
When the user clicks the link I want to write a cookie so I know whick link they selected. Here's how the link is created.
<a href="Profile.asp?Action=View&CId=<%=rs("tpClientId")%>&PId=<%=rs("tpProjectid")%>" name=tqproject language=vbscript onclick='buildname(<%Response.Write(chr(34) & rs("ptProjectDesc") & chr(34))%>)'><%=rs("ptProjectDesc")%></a>
This calls the function just fine but, using response.cookies causes an error (see below). I suppose it's something to do with client/server side processing but I don't know.
I don't want to use jscript to write the cookie (I'm using jscript in other areas just don't want to here, server seems much simpler).
I've tried without the language= and other version but can't get it to work. Here's the latest buildname function.
<script language=vbscript>
sub buildname(sName)
Response.Cookies("ProjName")=sName
end sub
</script>
I'm not using the <form> tag. Will use it if required.
I'm using ASP.
-
Jan 10th, 2001, 05:54 PM
#2
Addicted Member
<script language=vbscript>
sub buildname(sName)
Response.Cookies("ProjName")=sName
end sub
</script>
Response object is Not Part of VBSCRIPT .. It is Part of ASP
There fore It will not WORK !
If you can't pronounce my name, call me GURU 
-
Jan 11th, 2001, 09:31 AM
#3
Thread Starter
Member
I knew it didn't work, but I'm looking for a solution to the task I've outlined.
Can anyone point me in a direction to make this work(with whatever language, vbscript,jscript,asp).
-
Jan 11th, 2001, 09:59 AM
#4
Black Cat
From the server side, you would have to set the cookie before you send any HTML code (ie - Response.Write) as Cookies are sent as HTTP headers. So what you need to do is set the cookies on the page linked to, using the HTTP_REFERER Server Variable if needed to tell where the link came from.
Josh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|