Solved

Share Cookie value between asp and aspx pages

Posted on 2004-04-23
7
199 Views
Last Modified: 2011-04-14
I have an application which has both asp and aspx pages. in one of my asp page say login page am storing the loginid in cookie. i am not able to read or write this cookie value from my aspx page
like i used
response.Cookies("member_id") = member_id in asp page

and in aspx page

Response.write(request.cookies("member_id"))
but im not getting any values written

can anyone help me with this

Thanx in adavance
0
Comment
Question by:tonykmathew
  • 3
  • 2
7 Comments
 
LVL 11

Expert Comment

by:rdrunner
ID: 10897354
You need to set the response.Cookies("Member_ID").path property so its below the asp and aspx page...

If you dont set this property it will default to the ASP path and if the aspx path is in another folder it wont be able to see it



Hope this helps
0
 

Author Comment

by:tonykmathew
ID: 10897927
I dint get u clearly...where shall i set the path???...any smaple code?
0
 
LVL 11

Expert Comment

by:rdrunner
ID: 10898011
You need to set the path like this...


response.Cookies("Member_ID").path = "/mypath"
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:tonykmathew
ID: 10898035
thanx for ur help..but i got it worked in another way

In asp
response.Cookies("memberid") = member_id

In aspx
Response.Write(Request.Cookies("memberid").Value())

the '_'  in meber_id was giving me error!!! "object not set to an instance of an object!" dono why..but working now :)
0
 
LVL 11

Expert Comment

by:rdrunner
ID: 10898128
Setting a Virtual Path for the Cookie
The Path property sets the path that this cookie pertains to. The cookie will only be retrieved from the client if pages are retrieved from the directory set by Path.

The syntax for setting the Path property of a cookie is:

    Response.Cookies("CookieName").Path = /VirtualPathThe following sets the cookie's path.

    Response.Cookies("User").Path = "/customers"

If the Path property is not specified it will be set to the directory where the cookie was created. Setting a Path of root, "/", causes the cookie to be sent to the server throughout the site.

Here is the long version :)
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 11130978
PAQed, with points refunded (50)

GhostMod
Community Support Moderator
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question