Guys
I'm having trouble doing something as simple as setting and reading a cookie using vbscript.
The issue is this. I need to set a cookie which holds a database connection string depending on whether the code is running on a local server or my live webserver. I currently do this without cookies by simply setting the value of a variable using asp and servervariables("HTTP_POST") however I now need to do this in vbscript (for reasons to long winded to go into).
I have a link which calls a vbscript sub routine
This calls the subCode:<div id="QuoteButt"><a href="someurl" target="_blank" id="lnk" class="Link03">Click here</a></div>
Now, I can set this string in asp and store it in a variable however when I try to read it in vbscript, it's empty. I can store it in a cookie and I can read it by usingCode:<script language="VBScript"> sub lnk_onclick() set oConn = CreateObject("ADODB.Connection") 'now, here's the problem. I need to do something to determine what server I'm using. In asp I would do this: if request.servervariables("HTTP_HOST") = "localhost" Then strConnex = "Provider=sqloledb;SERVER=localserver,UID=myuid;PWD=mypwd;DATABASE=mydatabase" else strConnex = "Provider=sqloledb;SERVER=liveserver,UID=myuid;PWD=mypwd;DATABASE=mydatabase" end if 'do some other stuff end sub </script>
But this gives me every cookie stored for the session, which isn't good (also, it's html encoded which doesn't help).Code:'asp response.cookies("connex") = strConnex 'vbscript alert document.cookie
I just want to be able to read the connection string cookie using vbscript and use this to open my database conneciton! It aint rocket science. Is it?!
![]()




Reply With Quote