Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Save JavaScript Cookies in ASP Cookies
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mafifi
Junior Member

USA
308 Posts

Posted - 11 March 2010 :  13:27:42  Show Profile  Reply with Quote
I have a web page that pulls information from different applications on diffrent servers. One such application sends JavsScript cookies data to the client. Is it possible to grab these values and stuff them in ASP Session Variables or Cookies? I would love to see a working sample.

Regards,

Mo

HuwR
Forum Admin

United Kingdom
20611 Posts

Posted - 11 March 2010 :  14:25:36  Show Profile  Visit HuwR's Homepage  Reply with Quote
not sure what you are after, a cookie is a cookie it is a text file saved on the users machine they are language agnostic so you can just read them using ASP the same as you can read them using javascript
Go to Top of Page

mafifi
Junior Member

USA
308 Posts

Posted - 11 March 2010 :  16:07:33  Show Profile  Reply with Quote
quote:
Originally posted by HuwR

not sure what you are after, a cookie is a cookie it is a text file saved on the users machine they are language agnostic so you can just read them using ASP the same as you can read them using javascript



This is what I am trying to do:


<script language="javascript" type="text/javascript">
    document.cookie = "mycookie=2; expires=1/1/2020; path=/;";
</script>


<%
Dim myBrownie
'get the cookie
myBrownie = Request.Cookies("mycookie")
Response.Write("You ate " & myBrownie & " brownies")
%>


I do not see the value of the cookie until after I refresh the page.

Regards,

Mo

Edited by - mafifi on 11 March 2010 16:11:57
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20611 Posts

Posted - 11 March 2010 :  18:02:27  Show Profile  Visit HuwR's Homepage  Reply with Quote
well you won't because the asp code gets executed on the server before the page is sent to the client and then the javascript runs. so there is no cookie at the time request.Cookies is called
Go to Top of Page

mafifi
Junior Member

USA
308 Posts

Posted - 11 March 2010 :  19:23:06  Show Profile  Reply with Quote
This is the problem which I am trying to resolve. I am thinking about using Ajax to refresh the page and pull the cookie value(s).

Regards,

Mo
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20611 Posts

Posted - 12 March 2010 :  04:27:09  Show Profile  Visit HuwR's Homepage  Reply with Quote
maybe if you explain what you are trying to achieve we can offer suggestions, writing a cookie from the client and then trying to read it from the server without a postback just won't work, so what exactly are you trying to accomplish ?
Go to Top of Page

mafifi
Junior Member

USA
308 Posts

Posted - 12 March 2010 :  07:09:52  Show Profile  Reply with Quote
Here's what I would like to happen:

Application 'A' (Non ASP) will authenticate the user and send the 'User Information' to application 'B' (ASP) as JavaScript cookies. I want to delete the JavaScript cookies as soon as I am able to hold their values in ASP session variables and some of the 'User Information' will be encrypted and saved in a persistent ASP cookie to be used as needed throughout the application.

Regards,

Mo
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 12 March 2010 :  10:19:35  Show Profile  Reply with Quote
As Huw said, cookies operate independent of language so you could set the cookie in application A before transferring to application B which would then be able to read the cookie.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20611 Posts

Posted - 12 March 2010 :  11:12:23  Show Profile  Visit HuwR's Homepage  Reply with Quote
I'm still not following what you are trying to do,
You can't send information form A to B as javascript cookies, cookies are NOT javascript cookies are text files stored on the clients machine.

What is application A ? if it is able to write a cookie, then application B can just read them using ASP (by the way ASP is not a language either so can be vbscript or javascript), what are you trying to do exactly, pleasse explain more.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07