The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
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
Mo
Postet den
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
Postet den
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:
Code:
<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
Mo
Sist redigert av
Postet den
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
Postet den
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
Mo
Postet den
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 ?
Postet den
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.
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
Mo
Postet den
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.”
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Postet den
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.
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.
Email Member
Message Member
Post Moderation
Filopplasting
If you're having problems uploading, try choosing a smaller image.
Forhåndsvis post
Send Topic
Loading...